VSCodeVim / VSCodeVim/Vim

Replace after paste works against wrong text

Open
#3,695 1 comment 4 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 I copy lines in a buffer, paste them, and then perform a visual ('<,'>) replace, the replacements happen on the original lines, not the pasted ones.

To Reproduce
Steps to reproduce the behavior:

  1. Visually select lines in a buffer using shift-V (and optionally movement keys)
  2. Copy the selection with y
  3. Paste the line(s) elsewhere in the same buffer
  4. Re-select the pasted line(s) using shift-V and press : to enter a command
  5. Run '<,'>s/old/new/g

The text is replaced in the source lines, not in the pasted lines.

Expected behavior
All occurrences of old are replaced with new in the selection (new pasted text).

Environment (please complete the following information):

  • Extension Version: 1.4.0
  • OS Version: Darwin x64 17.7.0
  • VSCode version: 1.33.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

The issue names no files or tests. First reproduce the visual-select, yank, paste, and range-substitute steps in VSCodeVim, then trace how the selected range is passed to the substitute command. Done means replacing old with new in the pasted lines rather than the original source lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.