297
298
if (searchData.regex.multiline) {
299
>
return this._doFindNextMatchMultiline(model, searchStart, searcher, captureMatches);
textModelSearch.ts
300
>
}
301
return this._doFindNextMatchLineByLine(model, searchStart, searcher, captureMatches);
302
}
303
304
private static _doFindNextMatchMultiline(model: TextModel, searchStart: Position, searcher: Searcher, captureMatches: boolean): FindMatch | null {
306
>
const deltaOffset = model.getOffsetAt(searchTextStart);
307
>
const lineCount = model.getLineCount();
308
>
// We always execute multiline search over the lines joined with \n
309
>
// This makes it that \n will match the EOL for both CRLF and LF models
310
>
// We compensate for offset errors in `_getMultilineMatchRange`
311
>
const text = model.getValueInRange(new Range(searchTextStart.lineNumber, searchTextStart.column, lineCount, model.getLineMaxColumn(lineCount)), EndOfLinePreference.LF);
312
>
const lfCounter = (model.getEOL() === '\r\n' ? new LineFeedCounter(text) : null);
313
>
searcher.reset(searchStart.column - 1);
314
>
const m = searcher.next(text);
315
>
if (m) {
316
return createFindMatch(
317
this._getMultilineMatchRange(model, deltaOffset, text, lfCounter, m.index, m[0]),