public ISearchResult FindNext(ITextIterator textIterator, SearchOptions options, bool reverseSearch) { if (textIterator.SupportsSearch (options, reverseSearch)) { if (textIterator.SearchNext (searchPattern, options, reverseSearch)) { DefaultSearchResult sr = new DefaultSearchResult (textIterator, searchPattern.Length); if (!reverseSearch) textIterator.MoveAhead (searchPattern.Length); return sr; } else return null; } if (reverseSearch) throw new NotSupportedException (); int offset = InternalFindNext(textIterator, options); if (offset >= 0) { int pos = textIterator.Position; textIterator.Position = offset; DefaultSearchResult sr = new DefaultSearchResult (textIterator, searchPattern.Length); textIterator.Position = pos; return sr; } else return null; }
public bool SupportsReverseSearch (ITextIterator textIterator, SearchOptions options) { return textIterator.SupportsSearch (options, true); }