VSCodeVim / Vim

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

Macro duplicating inputs when recorded on multiple lines #9338

Open Brian-Alumbaugh opened 3 weeks ago

Brian-Alumbaugh commented 3 weeks ago

Describe the bug A macro that inserts characters across multiple lines inserts a different number of characters depending on how many lines it affected when the macro was recorded.

To Reproduce I made the following macro

$<C-v>%I//<Esc>0

Which when run while on the same line as a function declaration as seen below

image

Should comment out the entire function. Which it does when the command is run manually.

image

When the macro is executed, it will insert extra characters as seen below

image

I have confirmed that this macro runs as expected when used in a fresh NeoVim install, but will not work in VSCodeVim even with the NeoVim setting enabled.

The number of characters inserted by the macro is dependent on how many lines were involved in it's recording. So if the function you record the macro with is longer then it will insert more characters when rerun and if it's shorter then it will insert less. If the function is one line (as seen below) when the macro is recorded then the macro will work as expected and only insert one set of characters.

image

image

Expected behavior You would expect the macro to insert one set of // no matter how many lines the macro covers when it is recorded.

Environment (please complete the following information):