From fcff9787638e73eac0802ff6abdba6061a569d81 Mon Sep 17 00:00:00 2001 From: Alfred Reinold Baudisch Date: Mon, 31 Oct 2022 16:55:47 +0100 Subject: Shortcut and Bind to Remove Secondary Carets Adds the bind `ui_text_remove_secondary_carets` to TextEdit, with ESC as the default shortcut. When the bind is performed, if the TextEdit has multiple carets, `remove_secondary_carets` is called and secondary carets are removed. This is useful when multiple selects are performed with `add_select_for_next_occurrence` #67644 or when multiple multiple carets are manually added, then it's possible to go back to a single caret with a shortcut. Closes #67991 --- core/input/input_map.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core') diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp index 233065fe8b..aebb9caa2f 100644 --- a/core/input/input_map.cpp +++ b/core/input/input_map.cpp @@ -342,6 +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_toggle_insert_mode", TTRC("Toggle Insert Mode") }, { "ui_text_submit", TTRC("Text Submitted") }, { "ui_graph_duplicate", TTRC("Duplicate Nodes") }, @@ -671,6 +672,10 @@ const HashMap>> &InputMap::get_builtins() { inputs.push_back(InputEventKey::create_reference(Key::D | KeyModifierMask::CMD_OR_CTRL)); default_builtin_cache.insert("ui_text_add_selection_for_next_occurrence", inputs); + inputs = List>(); + inputs.push_back(InputEventKey::create_reference(Key::ESCAPE)); + default_builtin_cache.insert("ui_text_remove_secondary_carets", inputs); + inputs = List>(); inputs.push_back(InputEventKey::create_reference(Key::INSERT)); default_builtin_cache.insert("ui_text_toggle_insert_mode", inputs); -- cgit v1.2.3