public SearchResult FindNext(ITextIterator textIterator, int offset, int length) { string document = textIterator.TextBuffer.GetText(0, textIterator.TextBuffer.Length); while (textIterator.MoveAhead(1) && TextSelection.IsInsideRange(textIterator.Position, offset, length)) { Match m = regex.Match(document, textIterator.Position); if (m == null || m.Index <= 0 || m.Length <= 0) { } else { int delta = m.Index - textIterator.Position; if (delta <= 0 || textIterator.MoveAhead(delta)) { if (TextSelection.IsInsideRange(m.Index + m.Length - 1, offset, length)) { return(new RegexSearchResult(m)); } else { return(null); } } else { return(null); } } } return(null); }
int InternalFindNext(ITextIterator textIterator, int offset, int length) { while (textIterator.MoveAhead(1)) { if (textIterator.Position >= offset + length) { textIterator.Position = offset; } int position = textIterator.Position; if (Match(textIterator.Document, position, !SearchOptions.MatchCase, 0)) { if (!SearchOptions.MatchWholeWord || SearchReplaceUtilities.IsWholeWordAt(textIterator.Document, position, curMatchEndOffset - position)) { if (TextSelection.IsInsideRange(curMatchEndOffset - 1, offset, length)) { textIterator.MoveAhead(curMatchEndOffset - position - 1); return(position); } else { return(-1); } } } } return(-1); }
int InternalFindNext(ITextIterator textIterator, int offset, int length) { while (textIterator.MoveAhead(1)) { if (textIterator.Position >= offset + length) { textIterator.Position = offset; } if (SearchOptions.MatchCase ? MatchCaseSensitive(textIterator.Document, textIterator.Position, searchPattern) : MatchCaseInsensitive(textIterator.Document, textIterator.Position, searchPattern)) { if (!SearchOptions.MatchWholeWord || IsWholeWordAt(textIterator.Document, textIterator.Position, searchPattern.Length)) { if (TextSelection.IsInsideRange(textIterator.Position + searchPattern.Length - 1, offset, length)) { return(textIterator.Position); } else { return(-1); } } } } return(-1); }
public SearchResultMatch FindNext(ITextIterator textIterator, int offset, int length) { string document = textIterator.Document.GetText(0, textIterator.Document.TextLength); while (textIterator.MoveAhead(1)) { if (textIterator.Position >= offset + length) { textIterator.Position = offset; } Match m = regex.Match(document, textIterator.Position); if (m == null || !m.Success) { while (textIterator.Position < document.Length - 1) { if (!textIterator.MoveAhead(1)) { return(null); } } } else { int delta = m.Index - textIterator.Position; if (delta <= 0 || textIterator.MoveAhead(delta)) { if (TextSelection.IsInsideRange(m.Index + m.Length - 1, offset, length)) { return(new RegexSearchResult(m)); } else { return(null); } } else { return(null); } } } return(null); }