diff options
author | Rob Lourens <roblourens@gmail.com> | 2022-07-20 06:10:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-20 06:10:55 +0300 |
commit | 3d5662f389a90045e37381547dc7cfc41ca523ff (patch) | |
tree | 3e5cff46d86e52b4b8532c790d1a8dbfa2da58be /src | |
parent | 32f5e49082ca834c1caf44075220953689987ed0 (diff) |
Fix find with multiline regexes (#155672)
Fixes #154826
Diffstat (limited to 'src')
-rw-r--r-- | src/vs/editor/common/model/textModelSearch.ts | 4 | ||||
-rw-r--r-- | src/vs/editor/test/common/model/textModelSearch.test.ts | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/vs/editor/common/model/textModelSearch.ts b/src/vs/editor/common/model/textModelSearch.ts index 0d58500a2e6..87c4bd8ecf7 100644 --- a/src/vs/editor/common/model/textModelSearch.ts +++ b/src/vs/editor/common/model/textModelSearch.ts @@ -74,6 +74,10 @@ export function isMultilineRegexSource(searchString: string): boolean { for (let i = 0, len = searchString.length; i < len; i++) { const chCode = searchString.charCodeAt(i); + if (chCode === CharCode.LineFeed) { + return true; + } + if (chCode === CharCode.Backslash) { // move to next char diff --git a/src/vs/editor/test/common/model/textModelSearch.test.ts b/src/vs/editor/test/common/model/textModelSearch.test.ts index 493db522258..555a1f5f59a 100644 --- a/src/vs/editor/test/common/model/textModelSearch.test.ts +++ b/src/vs/editor/test/common/model/textModelSearch.test.ts @@ -747,6 +747,8 @@ suite('TextModelSearch', () => { assert(isMultilineRegexSource('foo\\r\\n')); assert(isMultilineRegexSource('\\n')); assert(isMultilineRegexSource('foo\\W')); + assert(isMultilineRegexSource('foo\n')); + assert(isMultilineRegexSource('foo\r\n')); }); test('issue #74715. \\d* finds empty string and stops searching.', () => { |