diff options
author | Alfred Reinold Baudisch <alfred@alfredbaudisch.com> | 2022-11-02 15:14:08 +0100 |
---|---|---|
committer | Alfred Reinold Baudisch <alfred@alfredbaudisch.com> | 2022-11-02 18:23:24 +0100 |
commit | a862583d05c30030ab42d2f0abe8e9211503ae22 (patch) | |
tree | 9e0cc5fb34b983c94d1b17fa0c2f1ff6fe072abe /scene/gui/text_edit.h | |
parent | 0a0e99cadc6e250ff2ee27ef31760eb9c2e21040 (diff) | |
download | redot-engine-a862583d05c30030ab42d2f0abe8e9211503ae22.tar.gz |
Unified shortcut to clear carets and selections
Refactors`ui_text_remove_secondary_carets` from https://github.com/godotengine/godot/pull/68089 as `ui_text_clear_carets_and_selection`, with extra behaviour:
- If there's only one active caret active with a selection, clears the selection.
- In case there's more than one caret active, removes the secondary carets and clears selections.
With this change, `TextEdit` then imitates the behaviour of VSCode for clearing carets and selections.
Diffstat (limited to 'scene/gui/text_edit.h')
-rw-r--r-- | scene/gui/text_edit.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 263a36aba8..92acbaf521 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -597,7 +597,7 @@ private: void _delete(bool p_word = false, bool p_all_to_right = false); void _move_caret_document_start(bool p_select); void _move_caret_document_end(bool p_select); - bool _should_remove_secondary_carets(); + bool _clear_carets_and_selection(); // Used in add_caret_at_carets void _get_above_below_caret_line_column(int p_old_line, int p_old_wrap_index, int p_old_column, bool p_below, int &p_new_line, int &p_new_column, int p_last_fit_x = -1) const; |