VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.83k stars 1.31k forks source link

visualstar fails to properly escape search string #9111

Closed zaneduffield closed 3 months ago

zaneduffield commented 3 months ago

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):

zaneduffield commented 3 months ago

I think the problem is here https://github.com/VSCodeVim/Vim/blob/2ec951a425e78569df0fb2cb1520ef68e39921b4/src/actions/commands/search.ts#L102

It should be replaceAll.