VSCodeVim / VSCodeVim/Vim

Macro duplicating inputs when recorded on multiple lines

Open
#9,338 1 comment 1 reaction 0 assignees View on GitHub

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

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

  • Extension (VsCodeVim) version: 1.28.1
  • VSCode version: 1.94
  • OS: Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.