From cd2aaa4c3fb24933e52125e936117c5bd5b4ef76 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 15 Apr 2021 19:10:27 +0200 Subject: [PATCH] Allow using Ctrl + Y to redo actions in the editor This is already possible in TextEdit nodes (including the script editor), but this change allows using Ctrl + Y in the 2D and 3D editors as well. The existing Ctrl + Shift + Z shortcut is still available. Both shortcuts will remain supported to avoid breaking user expectations. --- editor/editor_node.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 055baeb81e49..cf9b09b78470 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -409,6 +409,12 @@ void EditorNode::_unhandled_input(const Ref &p_event) { if (ED_IS_SHORTCUT("editor/filter_files", p_event)) { filesystem_dock->focus_on_filter(); } + if (k->get_command() && k->get_keycode() == KEY_Y) { + // Alternative shortcut for redo. + // Since `ED_SHORTCUT()` can only specify one key per shortcut action, + // we have to hardcode the alternative shortcut. + _menu_option_confirm(EDIT_REDO, true); + } if (ED_IS_SHORTCUT("editor/editor_2d", p_event)) { _editor_select(EDITOR_2D); @@ -6246,6 +6252,7 @@ EditorNode::EditorNode() { p->add_separator(); p->add_shortcut(ED_GET_SHORTCUT("ui_undo"), EDIT_UNDO, true); + // Note: Ctrl + Y can also be used to redo actions (see this class' `_unhandled_input()`). p->add_shortcut(ED_GET_SHORTCUT("ui_redo"), EDIT_REDO, true); p->add_separator();