summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorAlfred Reinold Baudisch <alfred@alfredbaudisch.com>2022-10-19 19:35:14 +0200
committerAlfred Reinold Baudisch <alfred@alfredbaudisch.com>2022-10-21 08:26:53 +0200
commit7d15ecc3affdee1ad89ef1a2eeaca6b894ae6548 (patch)
tree366b22fbd35f6e5c20048ba0f14926fa83091998 /doc/classes
parent431012e14845590249c1ade9d153c55b32c9cca7 (diff)
Add Selection and Caret for Next Occurrence of Selection
Adds the bind `add_selection_for_next_occurrence` to TextEdit, with CTRL+D as the default shortcut. When the bind is performed, ff a selection is currently active with the last caret in text fields, searches for the next occurrence of the selection, adds a caret and selects the next occurrence. If no selection is currently active with the last caret in text fields, selects the word currently under the caret. The action can be performed sequentially for all occurrences of the selection of the last caret and for all existing carets. The viewport is adjusted to the latest newly added caret. The bind and the behaviour is similar to VS Code's "Add Selection to Next Find Match" and JetBrains' "Add Selection for Next Occurrence". It takes advantage of the multi-caret API. The default shortcut for `select_word_under_caret` has been changed to ALT+G, in order to give priority to CTRL+D for `add_selection_for_next_occurrence` to better align with popular IDEs and editors.
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/ProjectSettings.xml9
-rw-r--r--doc/classes/TextEdit.xml6
2 files changed, 14 insertions, 1 deletions
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index a8080c70c6..f03fe15fb3 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -830,6 +830,13 @@
</member>
<member name="input/ui_swap_input_direction" type="Dictionary" setter="" getter="">
</member>
+ <member name="input/ui_text_add_selection_for_next_occurrence" type="Dictionary" setter="" getter="">
+ If a selection is currently active with the last caret in text fields, searches for the next occurrence of the selection, adds a caret and selects the next occurrence.
+ If no selection is currently active with the last caret in text fields, selects the word currently under the caret.
+ The action can be performed sequentially for all occurrences of the selection of the last caret and for all existing carets.
+ The viewport is adjusted to the latest newly added caret.
+ [b]Note:[/b] Default [code]ui_*[/code] actions cannot be removed as they are necessary for the internal logic of several [Control]s. The events assigned to the action can however be modified.
+ </member>
<member name="input/ui_text_backspace" type="Dictionary" setter="" getter="">
Default [InputEventAction] to delete the character before the text cursor.
[b]Note:[/b] Default [code]ui_*[/code] actions cannot be removed as they are necessary for the internal logic of several [Control]s. The events assigned to the action can however be modified.
@@ -984,7 +991,7 @@
</member>
<member name="input/ui_text_select_word_under_caret" type="Dictionary" setter="" getter="">
If no selection is currently active, selects the word currently under the caret in text fields. If a selection is currently active, deselects the current selection.
- [b]Note:[/b] Currently, this is only implemented in [TextEdit], not [LineEdit].
+ [b]Note:[/b] Default [code]ui_*[/code] actions cannot be removed as they are necessary for the internal logic of several [Control]s. The events assigned to the action can however be modified.
</member>
<member name="input/ui_text_submit" type="Dictionary" setter="" getter="">
Default [InputEventAction] to submit a text field.
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index b1fda25ecd..879a355f25 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -70,6 +70,12 @@
Register a new gutter to this [TextEdit]. Use [param at] to have a specific gutter order. A value of [code]-1[/code] appends the gutter to the right.
</description>
</method>
+ <method name="add_selection_for_next_occurrence">
+ <return type="void" />
+ <description>
+ Adds a selection and a caret for the next occurrence of the current selection. If there is no active selection, selects word under caret.
+ </description>
+ </method>
<method name="adjust_carets_after_edit">
<return type="void" />
<param index="0" name="caret" type="int" />