summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulb23 <p_batty@hotmail.co.uk>2016-03-17 20:35:04 +0000
committerPaulb23 <p_batty@hotmail.co.uk>2016-03-17 20:35:04 +0000
commit9c0e1524e56a3d38bf5ab281939770e806ac24e9 (patch)
treecda1763a78d5ace3b5b0d6859fa33698334def4e
parent4cc3fbeaffcffe5fe834b2b2afda18661836f769 (diff)
Fixed highlighting when word occurs as substring first
-rw-r--r--scene/gui/text_edit.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 59f9ee4a73..0fc8e39fef 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -3219,16 +3219,22 @@ int TextEdit::_get_column_pos_of_word(const String &p_key, const String &p_searc
p_from_column = 0;
}
- // match case
- col = p_search.findn(p_key, p_from_column);
-
- // whole words only
- if (col != -1) {
- if (col > 0 && _is_text_char(p_search[col-1])) {
- col = -1;
- } else if (_is_text_char(p_search[col+p_key.length()])) {
- col = -1;
+ while (col == -1 && p_from_column <= p_search.length()) {
+ // match case
+ col = p_search.findn(p_key, p_from_column);
+
+ // whole words only
+ if (col != -1) {
+ p_from_column=col;
+
+ if (col > 0 && _is_text_char(p_search[col-1])) {
+ col = -1;
+ } else if (_is_text_char(p_search[col+p_key.length()])) {
+ col = -1;
+ }
}
+
+ p_from_column+=1;
}
}
return col;