Skip to content

Commit

Permalink
Fix custom shortcut Ctrl-Space in Script Editor add a space
Browse files Browse the repository at this point in the history
  • Loading branch information
Hilderin committed Jul 7, 2024
1 parent f3af22b commit f20ee48
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,35 +317,40 @@ 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 = false;
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)) {
is_handled = true;
} else if (ED_IS_SHORTCUT("editor/editor_2d", p_event)) {
editor_select(EDITOR_2D);
is_handled = true;
} else if (ED_IS_SHORTCUT("editor/editor_3d", p_event)) {
editor_select(EDITOR_3D);
is_handled = true;
} else if (ED_IS_SHORTCUT("editor/editor_script", p_event)) {
editor_select(EDITOR_SCRIPT);
is_handled = true;
} else if (ED_IS_SHORTCUT("editor/editor_help", p_event)) {
emit_signal(SNAME("request_help_search"), "");
is_handled = true;
} else if (ED_IS_SHORTCUT("editor/editor_assetlib", p_event) && AssetLibraryEditorPlugin::is_available()) {
editor_select(EDITOR_ASSETLIB);
is_handled = true;
} else if (ED_IS_SHORTCUT("editor/editor_next", p_event)) {
_editor_select_next();
is_handled = true;
} else if (ED_IS_SHORTCUT("editor/editor_prev", p_event)) {
_editor_select_prev();
is_handled = true;
} else if (ED_IS_SHORTCUT("editor/command_palette", p_event)) {
_open_command_palette();
is_handled = true;
} else if (ED_IS_SHORTCUT("editor/toggle_last_opened_bottom_panel", p_event)) {
bottom_panel->toggle_last_opened_bottom_panel();
} else {
is_handled = true;
}

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

0 comments on commit f20ee48

Please sign in to comment.