浏览代码

Fix search to find "whole" words at end of line

Fix `_get_column_pos_of_word` so that the `SEARCH_WHOLE_WORDS` flag will properly find words that are at the end of a line.

Fixes #7326 .
(cherry picked from commit d1cf29fe9936b8a433601efa891453dcbb702227)
Johnson Earls 8 年之前
父节点
当前提交
f08aa02688
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      scene/gui/text_edit.cpp

+ 1 - 1
scene/gui/text_edit.cpp

@@ -3690,7 +3690,7 @@ int TextEdit::_get_column_pos_of_word(const String &p_key, const String &p_searc
 
 				if (col > 0 && _is_text_char(p_search[col-1])) {
 					col = -1;
-				} else if (_is_text_char(p_search[col+p_key.length()])) {
+				} else if ((col + p_key.length()) < p_search.length() && _is_text_char(p_search[col+p_key.length()])) {
 					col = -1;
 				}
 			}