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

Fix custom Ctrl-Space shortcut in Script Editor adds a space #94033

Conversation

Hilderin
Copy link
Contributor

@Hilderin Hilderin commented Jul 7, 2024

It seems that get_tree()->get_root()->set_input_as_handled() was not called in EditorNode::shortcut_input for some shortcuts.

It's not the most beautiful code, but I'm not sure how to make it better!!

Edit: was wrong issue.

@AThousandShips AThousandShips changed the title Fix custom shortcut Ctrl-Space in Script Editor add a space Fix custom Ctrl-Space shortcut in Script Editor adds a space Jul 7, 2024
@AThousandShips AThousandShips added this to the 4.3 milestone Jul 7, 2024
editor/editor_node.cpp Show resolved Hide resolved
editor/editor_node.cpp Outdated Show resolved Hide resolved
@AThousandShips

This comment was marked as resolved.

@Hilderin Hilderin force-pushed the fix-ctrl-space-script-editor-add-space branch from 1bd4a6c to f20ee48 Compare July 7, 2024 14:56
@@ -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;
Copy link
Member

Choose a reason for hiding this comment

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

How about defaulting to true and only setting it to false in a final else?
Should save a bunch of repetition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lol! So simple, really better! That's brilliant!! :)
Done!

@Hilderin Hilderin force-pushed the fix-ctrl-space-script-editor-add-space branch from f20ee48 to a7c4522 Compare July 7, 2024 19:54
@akien-mga akien-mga merged commit 85e994b into godotengine:master Jul 7, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom shortcut Ctrl-Space in Script Editor add a space
3 participants