diff options
author | Ryan Roden-Corrent <ryan@rcorre.net> | 2021-09-03 08:33:02 -0400 |
---|---|---|
committer | Ryan Roden-Corrent <ryan@rcorre.net> | 2021-09-03 08:33:02 -0400 |
commit | b296ad23b454c7ce92b819d4a5627d3c7bd8963d (patch) | |
tree | cee7629d6fe4f433586e31c8fca8f01d14d9996b | |
parent | d20031ccaec4c9ff50bc718cb8d79eefba0d7f11 (diff) |
Don't handle property_editor shortcuts on release.
Fixes #52336.
EditorProperty::unhandled_key_input was handling both press and release.
This means that if you press `ctrl+v` on an EditorProperty line input,
it will paste as expected on pressing `ctrl+v`, and accept the event so
EditorProperty will not see it. However, on release, LineEdit ignores
the event and EditorProperty still catches and handles it, using its own
paste implementation.
-rw-r--r-- | editor/editor_inspector.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index fee27dae58..5bf84c155e 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -799,15 +799,19 @@ void EditorProperty::unhandled_key_input(const Ref<InputEvent> &p_event) { return; } - if (ED_IS_SHORTCUT("property_editor/copy_property", p_event)) { - menu_option(MENU_COPY_PROPERTY); - accept_event(); - } else if (ED_IS_SHORTCUT("property_editor/paste_property", p_event) && !is_read_only()) { - menu_option(MENU_PASTE_PROPERTY); - accept_event(); - } else if (ED_IS_SHORTCUT("property_editor/copy_property_path", p_event)) { - menu_option(MENU_COPY_PROPERTY_PATH); - accept_event(); + const Ref<InputEventKey> k = p_event; + + if (k.is_valid() && k->is_pressed()) { + if (ED_IS_SHORTCUT("property_editor/copy_property", p_event)) { + menu_option(MENU_COPY_PROPERTY); + accept_event(); + } else if (ED_IS_SHORTCUT("property_editor/paste_property", p_event) && !is_read_only()) { + menu_option(MENU_PASTE_PROPERTY); + accept_event(); + } else if (ED_IS_SHORTCUT("property_editor/copy_property_path", p_event)) { + menu_option(MENU_COPY_PROPERTY_PATH); + accept_event(); + } } } |