"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.
This commit is contained in:
parent
a2f90d565a
commit
676627e1d1
3 changed files with 21 additions and 7 deletions
|
|
@ -3193,7 +3193,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));
|
||||
|
|
@ -3225,6 +3225,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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue