VSCodeVim / VSCodeVim/Vim

`gv` in a macro reselects what was selected before the macro

Open
#8,636 0 comments 0 reactions 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

First of all, thank you folks for maintaining this extremely useful extension!

Describe the bug
gv works fine to reselect my previous selection. However, when used in a macro, it will go back and select what was selected before the macro, and not during the macro, as one would expect.

To Reproduce
Having the following:

hello there

With the cursor over hello, press: qqviw<Esc>gvq to:

  • start recording a macro on the q register (qq)
  • select hello (viw)
  • deselect (<Esc>)
  • reselect (gv)
  • and end the macro (q).

After that, move the cursor to the next word, and press @q to replay the macro.

The expected result is, with [] to indicate the selected text:

hello [there]

However, the actual result is:

[hello] there

Environment:
Extension version: 1.26.0
VS Code version: Code 1.82.2 (Universal) (abd2f3db4bdb28f9e95536dfa84d8479f1eb312d, 2023-09-14T05:59:47.790Z)
OS version: Darwin x64 21.6.0
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz (8 x 2900)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 2, 2, 2
Memory (System) 16.00GB (3.96GB free)
Process Argv
Screen Reader no
VM 0%

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 issue in VS Code using the qqviw<Esc>gvq recording and replay it with @q. Trace how macro recording/replay interacts with gv, then verify that replay selects the word encountered during the macro rather than the earlier selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.