Fix escaping of multiple forward slashes in visualstar search (#9112)

Fixes #9111
This commit is contained in:
zaneduffield 2024-07-04 06:19:28 +10:00 committed by GitHub
parent 2ec951a425
commit 0216186037
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -99,7 +99,7 @@ async function createSearchStateAndMoveToMatch(args: {
return;
}
const escapedNeedle = escapeRegExp(needle).replace('/', '\\/');
const escapedNeedle = escapeRegExp(needle).replaceAll('/', '\\/');
const searchString = isExact ? `\\<${escapedNeedle}\\>` : escapedNeedle;
// Start a search for the given term.

View File

@ -1088,9 +1088,9 @@ suite('Mode Visual', () => {
newTest({
title: '`*` escapes `/` properly',
start: ['one |two/three four', 'one two/three four'],
start: ['one |two//three four', 'one two//three four'],
keysPressed: 'vE*',
end: ['one two/three four', 'one |two/three four'],
end: ['one two//three four', 'one |two//three four'],
endMode: Mode.Normal,
});