VSCodeVim / VSCodeVim/Vim

"paste without overriding" example not working for single character

Open
#4,297 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

Describe the bug
I use this example from the readme:

    "vim.visualModeKeyBindingsNonRecursive": [
        {
            "before": [
                "p",
            ],
            "after": [
                "p",
                "g",
                "v",
                "y"
            ]
        }
    ],

It works fine for most examples. But whenever I paste over a single character, it does not work. It does however work if I manually type out "pgvy". So for some reason the behaviour differs between manually writing characters and using the key remapping.

To Reproduce
Steps to reproduce the behavior:

  1. Write "test x"
  2. select "test" in visual mode
  3. press y
  4. select x in visual mode
  5. press p
  6. press p again
  7. The resulting output is "test testx"

Worth noting is that the bug does not happen if I move around my selection before pasting. So if I press "bw" between step 4 and 5 the bug does not happen.

Expected behavior
The output should be "test ttestest"

log

[Extension Host] ModeHandler: debug: handling key=v.
[Extension Host] Remapper: debug: trying to find matching remap. keys=v. mode=Normal. keybindings=normalModeKeyBindingsMap.
[Extension Host] Remapper: debug: trying to find matching remap. keys=v. mode=Normal. keybindings=normalModeKeyBindingsNonRecursiveMap.
[Extension Host] Remapper: verbose: key=v. keySlice=v.
[Extension Host] ModeHandler: debug: handling key=e.
[Extension Host] Remapper: debug: trying to find matching remap. keys=v,e. mode=Visual. keybindings=visualModeKeyBindingsMap.
[Extension Host] Remapper: debug: trying to find matching remap. keys=v,e. mode=Visual. keybindings=visualModeKeyBindingsNonRecursiveMap.
[Extension Host] Remapper: verbose: key=v,e. keySlice=ve.
[Extension Host] Remapper: verbose: key=v,e. keySlice=e.
[Extension Host] ModeHandler: debug: handling key=y.
[Extension Host] Remapper: debug: trying to find matching remap. keys=y. mode=Visual. keybindings=visualModeKeyBindingsMap.
[Extension Host] Remapper: debug: trying to find matching remap. keys=y. mode=Visual. keybindings=visualModeKeyBindingsNonRecursiveMap.
[Extension Host] Remapper: verbose: key=y. keySlice=y.
[Extension Host] ModeHandler: debug: handling key=w.
[Extension Host] Remapper: debug: trying to find matching remap. keys=w. mode=Normal. keybindings=normalModeKeyBindingsMap.
[Extension Host] Remapper: debug: trying to find matching remap. keys=w. mode=Normal. keybindings=normalModeKeyBindingsNonRecursiveMap.
[Extension Host] Remapper: verbose: key=w. keySlice=w.
[Extension Host] ModeHandler: debug: handling key=v.
[Extension Host] Remapper: debug: trying to find matching remap. keys=v. mode=Normal. keybindings=normalModeKeyBindingsMap.
[Extension Host] Remapper: debug: trying to find matching remap. keys=v. mode=Normal. keybindings=normalModeKeyBindingsNonRecursiveMap.
[Extension Host] Remapper: verbose: key=v. keySlice=v.
[Extension Host] ModeHandler: debug: handling key=p.
[Extension Host] Remapper: debug: trying to find matching remap. keys=v,p. mode=Visual. keybindings=visualModeKeyBindingsMap.
[Extension Host] Remapper: debug: trying to find matching remap. keys=v,p. mode=Visual. keybindings=visualModeKeyBindingsNonRecursiveMap.
[Extension Host] Remapper: verbose: key=v,p. keySlice=vp.
[Extension Host] Remapper: verbose: key=v,p. keySlice=p.
[Extension Host] Remapper: verbose: key sequences need to match precisely. precedingKeys=v.
[Extension Host] ModeHandler: debug: handling key=p.
[Extension Host] Remapper: debug: trying to find matching remap. keys=p. mode=Normal. keybindings=normalModeKeyBindingsMap.
[Extension Host] Remapper: debug: trying to find matching remap. keys=p. mode=Normal. keybindings=normalModeKeyBindingsNonRecursiveMap.
[Extension Host] Remapper: verbose: key=p. keySlice=p.

Environment (please complete the following information):

  • Extension Version: 1.11.3
  • OS Version: Windows_NT x64 10.0.16299
  • VSCode version: 1.40.1

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 single-character paste sequence from the issue, then trace the Remapper and ModeHandler paths shown in the log for visual-mode p and the non-recursive pgvy mapping. Done means the reproduced case produces "test ttestest", while the manually typed sequence and the movement variant continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, 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.