From f26a2e84d16da48f79d68e1021021675c31b18d1 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Fri, 11 Oct 2019 17:03:37 +0200 Subject: [PATCH] Fixes #65281: Treat the presence of \w as an indicator of a multiline regex search string --- src/vs/editor/common/model/textModelSearch.ts | 2 +- .../test/common/model/textModelSearch.test.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/common/model/textModelSearch.ts b/src/vs/editor/common/model/textModelSearch.ts index f350079ee69..4622af82cbc 100644 --- a/src/vs/editor/common/model/textModelSearch.ts +++ b/src/vs/editor/common/model/textModelSearch.ts @@ -85,7 +85,7 @@ export function isMultilineRegexSource(searchString: string): boolean { } const nextChCode = searchString.charCodeAt(i); - if (nextChCode === CharCode.n || nextChCode === CharCode.r || nextChCode === CharCode.W) { + if (nextChCode === CharCode.n || nextChCode === CharCode.r || nextChCode === CharCode.W || nextChCode === CharCode.w) { return true; } } diff --git a/src/vs/editor/test/common/model/textModelSearch.test.ts b/src/vs/editor/test/common/model/textModelSearch.test.ts index aa90e1c0c3f..2a55d718b50 100644 --- a/src/vs/editor/test/common/model/textModelSearch.test.ts +++ b/src/vs/editor/test/common/model/textModelSearch.test.ts @@ -721,6 +721,20 @@ suite('TextModelSearch', () => { ); }); + test('issue #65281. \w should match line break.', () => { + assertFindMatches( + [ + 'this/is{', + 'a test', + '}', + ].join('\n'), + 'this/\\w*[^}]*', true, false, null, + [ + [1, 1, 3, 1] + ] + ); + }); + test('Simple find using unicode escape sequences', () => { assertFindMatches( regularText.join('\n'), -- GitLab