"Whole Words" search can detect word boundaries inside the search term.
For example, searching for ".func" will now match in "a.func" even with Whole Words enabled.
(cherry picked from commit 676627e1d1)
This commit is contained in:
committed by
Yuri Sizov
parent
222cba2aab
commit
04bd9cc06c
@ -3221,7 +3221,7 @@ TEST_CASE("[SceneTree][TextEdit] search") {
|
||||
TextEdit *text_edit = memnew(TextEdit);
|
||||
SceneTree::get_singleton()->get_root()->add_child(text_edit);
|
||||
|
||||
text_edit->set_text("hay needle, hay\nHAY NEEDLE, HAY");
|
||||
text_edit->set_text("hay needle, hay\nHAY NEEDLE, HAY\nwordword.word.word");
|
||||
int length = text_edit->get_line(1).length();
|
||||
|
||||
CHECK(text_edit->search("test", 0, 0, 0) == Point2i(-1, -1));
|
||||
@ -3253,6 +3253,11 @@ TEST_CASE("[SceneTree][TextEdit] search") {
|
||||
CHECK(text_edit->search("need", TextEdit::SEARCH_WHOLE_WORDS | TextEdit::SEARCH_MATCH_CASE, 0, 0) == Point2i(-1, -1));
|
||||
CHECK(text_edit->search("need", TextEdit::SEARCH_WHOLE_WORDS | TextEdit::SEARCH_MATCH_CASE | TextEdit::SEARCH_BACKWARDS, 0, 0) == Point2i(-1, -1));
|
||||
|
||||
CHECK(text_edit->search("word", TextEdit::SEARCH_WHOLE_WORDS, 2, 0) == Point2i(9, 2));
|
||||
CHECK(text_edit->search("word", TextEdit::SEARCH_WHOLE_WORDS, 2, 10) == Point2i(14, 2));
|
||||
CHECK(text_edit->search(".word", TextEdit::SEARCH_WHOLE_WORDS, 2, 0) == Point2i(8, 2));
|
||||
CHECK(text_edit->search("word.", TextEdit::SEARCH_WHOLE_WORDS, 2, 0) == Point2i(9, 2));
|
||||
|
||||
ERR_PRINT_OFF;
|
||||
CHECK(text_edit->search("", 0, 0, 0) == Point2i(-1, -1));
|
||||
CHECK(text_edit->search("needle", 0, -1, 0) == Point2i(-1, -1));
|
||||
|
||||
Reference in New Issue
Block a user