From 5347c2b10e7f5d61fd7714f4c848d45803b250f5 Mon Sep 17 00:00:00 2001 From: Christian Cuevas Date: Mon, 14 Nov 2022 03:18:21 -0800 Subject: 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. --- editor/code_editor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'editor') 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; } } -- cgit v1.2.3