Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using Ctrl + Y to redo actions in the editor #47929

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,12 @@ void EditorNode::_unhandled_input(const Ref<InputEvent> &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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we can't use if (k->is_action("ui_redo", true)) { instead?

Copy link
Member Author

@Calinou Calinou Apr 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Paulb23 Wouldn't this cause the redo action to apply twice when pressing Ctrl + Shift + Z since there's also the ui_redo shortcut that is being listened to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't do as the popup menu will call accept_event, though might need to also call that here.

// 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);
Expand Down Expand Up @@ -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();
Expand Down