summaryrefslogtreecommitdiff
path: root/core/input
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-05-15 18:22:52 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2021-05-22 23:47:43 +0200
commit80f4e407b231bc19d0d2ef0aaaf9e3389f9a621d (patch)
tree5a1a1061cb5edff43310974ca36d363a7b41c910 /core/input
parentde4c17f716acf0efe484a3f553ebd817fd4c256e (diff)
Add a keyboard shortcut to select the word under cursor in TextEdit
This also acts as a general-purpose "deselect" shortcut since pressing it a second time will deselect text. This is available both in the script editor and in TextEdit fields in use, both in the editor and projects. The Duplicate Line script editor shortcut was moved to Ctrl + Shift + D since it conflicts with the new shortcut (Ctrl + D). The rationale for doing so is that Duplicate Line is a less commonly used action, and its behavior can be replicated by copying and pasting the current line anyway. (With no selection active, the whole line will be copied.)
Diffstat (limited to 'core/input')
-rw-r--r--core/input/input_map.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp
index 424509eb47..a43ad4ed7d 100644
--- a/core/input/input_map.cpp
+++ b/core/input/input_map.cpp
@@ -353,6 +353,7 @@ static const _BuiltinActionDisplayName _builtin_action_display_names[] = {
{ "ui_text_scroll_down", TTRC("Scroll Down") },
{ "ui_text_scroll_down.OSX", TTRC("Scroll Down") },
{ "ui_text_select_all", TTRC("Select All") },
+ { "ui_text_select_word_under_caret", TTRC("Select Word Under Caret") },
{ "ui_text_toggle_insert_mode", TTRC("Toggle Insert Mode") },
{ "ui_graph_duplicate", TTRC("Duplicate Nodes") },
{ "ui_graph_delete", TTRC("Delete Nodes") },
@@ -651,6 +652,10 @@ const OrderedHashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
default_builtin_cache.insert("ui_text_select_all", inputs);
inputs = List<Ref<InputEvent>>();
+ inputs.push_back(InputEventKey::create_reference(KEY_D | KEY_MASK_CMD));
+ default_builtin_cache.insert("ui_text_select_word_under_caret", inputs);
+
+ inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(KEY_INSERT));
default_builtin_cache.insert("ui_text_toggle_insert_mode", inputs);