
Hello,
there is a bug with the FindNext (and also ReplaceNext) method :
public void testFindNext() {
CodeDocument doc = new CodeDocument();
EditorSearchOptions opt = new EditorSearchOptions { FindText = "A", MatchWholeWord = true, SearchUp = false, PatternProvider = SearchPatternProviders.Normal };
doc.SetText("AA");
ISearchResult r = doc.CurrentSnapshot.FindNext(opt, 2, true).Results.FirstOrDefault();
bool haveBug = r != null;
opt.MatchWholeWord = false;
r = doc.CurrentSnapshot.FindNext(opt, 2, true).Results.FirstOrDefault();
haveBug = r != null;
doc.SetText("@A");
opt.MatchWholeWord = true;
r = doc.CurrentSnapshot.FindNext(opt, 2, true).Results.FirstOrDefault();
haveBug = r != null;
}
For the first search with the "AA" text and MatchWholeWorld = true the result is the one expected, i.e null.
For the second search with the "AA" text and MatchWholeWorld = false the result is not the one expected. There is a match though it should not.
For the third search with the "@A" text and MatchWholeWorld = true the result is not the one expected. There is a match though it should not.
So two kinds of problems : the one with MatchWholeWorld = false and the one with the @ (and possibly other as I can see, such as $ and [ and ..)
Regards.
[Modified 12 years ago]