diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-09-14 13:35:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 13:35:10 +0200 |
commit | 6ad7b334a1122f82447c09826417b6095de0177b (patch) | |
tree | c9839ac548c46de514eb8fff6cd698c943c772f7 | |
parent | bec06b01f80ec0f99c979fc16d084e08256411b4 (diff) | |
parent | a442b063132fe7459cf59e0a3f7852cdad85613b (diff) |
Merge pull request #52260 from ThreeRhinosInAnElephantCostume/fixfindonfocus
Fix Find Next shortcut not working when search bar is focused
-rw-r--r-- | editor/code_editor.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 89c2e49814..6764ebcc4e 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -715,7 +715,27 @@ void CodeTextEditor::input(const Ref<InputEvent> &event) { ERR_FAIL_COND(event.is_null()); const Ref<InputEventKey> key_event = event; - if (!key_event.is_valid() || !key_event->is_pressed() || !text_editor->has_focus()) { + + if (!key_event.is_valid()) { + return; + } + if (!key_event->is_pressed()) { + return; + } + + if (!text_editor->has_focus()) { + if ((find_replace_bar != nullptr && find_replace_bar->is_visible()) && (find_replace_bar->has_focus() || find_replace_bar->is_ancestor_of(get_focus_owner()))) { + if (ED_IS_SHORTCUT("script_text_editor/find_next", key_event)) { + find_replace_bar->search_next(); + accept_event(); + return; + } + if (ED_IS_SHORTCUT("script_text_editor/find_previous", key_event)) { + find_replace_bar->search_prev(); + accept_event(); + return; + } + } return; } |