Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visualstar fails to properly escape search string #9111

Closed
zaneduffield opened this issue Jul 3, 2024 · 1 comment · Fixed by #9112
Closed

visualstar fails to properly escape search string #9111

zaneduffield opened this issue Jul 3, 2024 · 1 comment · Fixed by #9112

Comments

@zaneduffield
Copy link
Contributor

Describe the bug
When using the visualstar feature on a selection containing multiple forward slashes, only the first slash is escaped in the regex used for the search.

To Reproduce

  1. Paste the following text into a file
    //a
    //a
    
  2. Select //a in visual mode
  3. Press * (with vim.visualstar enabled in settings)
  4. Observe no matches (the regex used is \//a)

Expected behavior
The regex used for the search should be \/\/a

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.27.3
  • VSCode version: 1.90.2
  • OS: Windows 10
@zaneduffield
Copy link
Contributor Author

I think the problem is here

const escapedNeedle = escapeRegExp(needle).replace('/', '\\/');

It should be replaceAll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant