diff options
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r-- | editor/code_editor.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 3ea970a0f0..95c7cc0bf1 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -307,18 +307,19 @@ void FindReplaceBar::_update_results_count() { break; } + int pos_subsequent = pos + searched.length(); if (is_whole_words()) { - from_pos++; // Making sure we won't hit the same match next time, if we get out via a continue. - if (pos > 0 && !is_symbol(full_text[pos - 1])) { + from_pos = pos + 1; // Making sure we won't hit the same match next time, if we get out via a continue. + if (pos > 0 && !(is_symbol(full_text[pos - 1]) || full_text[pos - 1] == '\n')) { continue; } - if (pos + searched.length() < full_text.length() && !is_symbol(full_text[pos + searched.length()])) { + if (pos_subsequent < full_text.length() && !(is_symbol(full_text[pos_subsequent]) || full_text[pos_subsequent] == '\n')) { continue; } } results_count++; - from_pos = pos + searched.length(); + from_pos = pos_subsequent; } } @@ -657,7 +658,7 @@ FindReplaceBar::FindReplaceBar() { // be handled too late if they weren't handled here. void CodeTextEditor::_input(const Ref<InputEvent> &event) { const Ref<InputEventKey> key_event = event; - if (!key_event.is_valid() || !key_event->is_pressed()) { + if (!key_event.is_valid() || !key_event->is_pressed() || !text_editor->has_focus()) { return; } |