Skip to content

Commit

Permalink
Merge pull request #94033 from Hilderin/fix-ctrl-space-script-editor-…
Browse files Browse the repository at this point in the history
…add-space

Fix custom Ctrl-Space shortcut in Script Editor adds a space
  • Loading branch information
akien-mga committed Jul 7, 2024
2 parents 39d9ff2 + a7c4522 commit 85e994b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,10 @@ void EditorNode::shortcut_input(const Ref<InputEvent> &p_event) {

Ref<InputEventKey> k = p_event;
if ((k.is_valid() && k->is_pressed() && !k->is_echo()) || Object::cast_to<InputEventShortcut>(*p_event)) {
EditorPlugin *old_editor = editor_plugin_screen;

bool is_handled = true;
if (ED_IS_SHORTCUT("editor/filter_files", p_event)) {
FileSystemDock::get_singleton()->focus_on_filter();
get_tree()->get_root()->set_input_as_handled();
}

if (ED_IS_SHORTCUT("editor/editor_2d", p_event)) {
} else if (ED_IS_SHORTCUT("editor/editor_2d", p_event)) {
editor_select(EDITOR_2D);
} else if (ED_IS_SHORTCUT("editor/editor_3d", p_event)) {
editor_select(EDITOR_3D);
Expand All @@ -343,9 +339,10 @@ void EditorNode::shortcut_input(const Ref<InputEvent> &p_event) {
} else if (ED_IS_SHORTCUT("editor/toggle_last_opened_bottom_panel", p_event)) {
bottom_panel->toggle_last_opened_bottom_panel();
} else {
is_handled = false;
}

if (old_editor != editor_plugin_screen) {
if (is_handled) {
get_tree()->get_root()->set_input_as_handled();
}
}
Expand Down

0 comments on commit 85e994b

Please sign in to comment.