From a862583d05c30030ab42d2f0abe8e9211503ae22 Mon Sep 17 00:00:00 2001 From: Alfred Reinold Baudisch Date: Wed, 2 Nov 2022 15:14:08 +0100 Subject: 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. --- core/input/input_map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp index aebb9caa2f..1c7d71e309 100644 --- a/core/input/input_map.cpp +++ b/core/input/input_map.cpp @@ -342,7 +342,7 @@ static const _BuiltinActionDisplayName _builtin_action_display_names[] = { { "ui_text_select_all", TTRC("Select All") }, { "ui_text_select_word_under_caret", TTRC("Select Word Under Caret") }, { "ui_text_add_selection_for_next_occurrence", TTRC("Add Selection for Next Occurrence") }, - { "ui_text_remove_secondary_carets", TTRC("Remove Secondary Carets") }, + { "ui_text_clear_carets_and_selection", TTRC("Clear Carets and Selection") }, { "ui_text_toggle_insert_mode", TTRC("Toggle Insert Mode") }, { "ui_text_submit", TTRC("Text Submitted") }, { "ui_graph_duplicate", TTRC("Duplicate Nodes") }, @@ -674,7 +674,7 @@ const HashMap>> &InputMap::get_builtins() { inputs = List>(); inputs.push_back(InputEventKey::create_reference(Key::ESCAPE)); - default_builtin_cache.insert("ui_text_remove_secondary_carets", inputs); + default_builtin_cache.insert("ui_text_clear_carets_and_selection", inputs); inputs = List>(); inputs.push_back(InputEventKey::create_reference(Key::INSERT)); -- cgit v1.2.3