summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorChristian Cuevas <ccpotential@gmail.com>2022-11-14 03:18:21 -0800
committerChristian Cuevas <ccpotential@gmail.com>2022-11-16 14:02:16 -0800
commit5347c2b10e7f5d61fd7714f4c848d45803b250f5 (patch)
treee164bb41399121145d6d2512a8ec1c06dae0ee4a /editor
parent33e65f275444744b0e346be19c94674788803f05 (diff)
Fix "Search" match inconsistencies
- Offset by searched length not line text - Continue searching line for whole word matches on mismatch: Breaking at this point makes it so that upon any whole word mismatch all potential matches after this point inline are skipped, to avoid this unwanted behavior we continue searching the line positioned after the mismatch.
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 510dc345bf..1e734bb97f 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -377,10 +377,12 @@ void FindReplaceBar::_update_results_count() {
if (is_whole_words()) {
if (col_pos > 0 && !is_symbol(line_text[col_pos - 1])) {
- break;
+ col_pos += searched.length();
+ continue;
}
- if (col_pos + line_text.length() < line_text.length() && !is_symbol(line_text[col_pos + searched.length()])) {
- break;
+ if (col_pos + searched.length() < line_text.length() && !is_symbol(line_text[col_pos + searched.length()])) {
+ col_pos += searched.length();
+ continue;
}
}