Fix whole word search slowdown in editor

Reduce repeated iteration through the full text
when counting the number of occurrences of whole
words while searching a file in the editor.

(cherry picked from commit 2433287871)
This commit is contained in:
Maganty Rushyendra 2020-06-12 17:28:43 +08:00 committed by Rémi Verschelde
parent 01061c6fbb
commit be0eba0f75
1 changed files with 1 additions and 1 deletions

View File

@ -320,7 +320,7 @@ void FindReplaceBar::_update_results_count() {
if (pos == -1) break;
if (is_whole_words()) {
from_pos++; // Making sure we won't hit the same match next time, if we get out via a continue.
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]))
continue;
if (pos + searched.length() < full_text.length() && !is_symbol(full_text[pos + searched.length()]))