Fixed highlighting when word occurs as substring first
(cherry picked from commit 9c0e1524e5
)
This commit is contained in:
parent
68b7f9d87a
commit
1369b38d85
|
@ -3198,16 +3198,22 @@ int TextEdit::_get_column_pos_of_word(const String &p_key, const String &p_searc
|
||||||
p_from_column = 0;
|
p_from_column = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// match case
|
while (col == -1 && p_from_column <= p_search.length()) {
|
||||||
col = p_search.findn(p_key, p_from_column);
|
// match case
|
||||||
|
col = p_search.findn(p_key, p_from_column);
|
||||||
|
|
||||||
// whole words only
|
// whole words only
|
||||||
if (col != -1) {
|
if (col != -1) {
|
||||||
if (col > 0 && _is_text_char(p_search[col-1])) {
|
p_from_column=col;
|
||||||
col = -1;
|
|
||||||
} else if (_is_text_char(p_search[col+p_key.length()])) {
|
if (col > 0 && _is_text_char(p_search[col-1])) {
|
||||||
col = -1;
|
col = -1;
|
||||||
|
} else if (_is_text_char(p_search[col+p_key.length()])) {
|
||||||
|
col = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p_from_column+=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return col;
|
return col;
|
||||||
|
|
Loading…
Reference in New Issue