Macro duplicating inputs when recorded on multiple lines
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
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
Should comment out the entire function. Which it does when the command is run manually.
When the macro is executed, it will insert extra characters as seen below
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.
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):
- Extension (VsCodeVim) version: 1.28.1
- VSCode version: 1.94
- OS: Windows
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the macro using <$C-v>%I//0 on a multiline function and compare manual execution with recorded execution. Vary the number of lines present when recording to confirm whether inserted characters scale with that length. Done means the macro inserts one set of // regardless of the number of lines involved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100