diff options
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r-- | editor/code_editor.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index b188e1faca..43fc581023 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -122,24 +122,12 @@ void FindReplaceBar::unhandled_input(const Ref<InputEvent> &p_event) { ERR_FAIL_COND(p_event.is_null()); Ref<InputEventKey> k = p_event; - if (!k.is_valid() || !k->is_pressed()) { - return; - } - - Control *focus_owner = get_viewport()->gui_get_focus_owner(); - if (text_editor->has_focus() || (focus_owner && vbc_lineedit->is_ancestor_of(focus_owner))) { - bool accepted = true; - switch (k->get_keycode()) { - case Key::ESCAPE: { - _hide_bar(); - } break; - default: { - accepted = false; - } break; - } + if (k.is_valid() && k->is_action_pressed(SNAME("ui_cancel"), false, true)) { + Control *focus_owner = get_viewport()->gui_get_focus_owner(); - if (accepted) { + if (text_editor->has_focus() || (focus_owner && vbc_lineedit->is_ancestor_of(focus_owner))) { + _hide_bar(); accept_event(); } } |