VSCodeVim / VSCodeVim/Vim

Yank text to register appends text rather than replacing that register

Open
#4,774 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug
When yanking text, for instance, to register a, when I paste that text, it seems to append what I yanked to what was already in that register.

This seems to happen on and off, but more often when using the ctrl-r + register feature in insert mode. (ctrl+r followed by a register inserts that register while in insert mode in actual vim).

A related bug - the . register is supposed to store what you typed last. So using the ctrl-r trick, you should be able to go into insert mode, then press ctrl-r + ., and have it re-type what you previously typed in insert mode. Again, it prepends erroneous characters to the inserted text, usually, the character you used in normal mode to get into insert mode (c, a, I, etc..).

To Reproduce
Steps to reproduce the behaviour:

Yank some text to register a:
ve "ay (text "this")
Yank some more text to register a:
2w ve "ay (text "text")
Paste register a:
"ap or i ctrl-r a
Outputs "thistext" instead of "text" (the last yanked text into that register)

Expected behaviour
yanking to a register should replace that register. pasting from the . register should work as expected.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: Latest
  • VSCode version: Latest
  • OS: Macos Catalina

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

Start by reproducing the register behavior with the listed normal-mode yanks, "ap, and Ctrl-R in insert mode, including the . register case. Trace the register handling for yanking, pasting, and insert-mode Ctrl-R, then verify that each yank replaces the register and that . retypes only the previous insert-mode text.

Written by the indexing model from the issue text.

Assessment

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