VSCodeVim / VSCodeVim/Vim

Visual changes across range terminate when the line count expands

Open
#2,959 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
Generically speaking it seems that visual changes across line ranges will terminate when the line count of the block increases. For example, if the selected range is 3 lines, and the replacement adds new lines, it will terminate when the 3rd line in the replacement text is encountered ... I know thats pretty abstract so see to reproduce for an example...

To Reproduce
Steps to reproduce the behavior:

  1. Enter the following example text:
    {"k":"v", "k2":"v2"},
    {"k":"v", "k2":"v2"},
    {"k":"v", "k2":"v2"},
  1. Select the 3 lines with visual mode (shift-V)
  2. Choose a change across the visual set :s/",/",\r/g (add a new line where you see ",)
  3. Actual final state
    {"k":"v",
 "k2":"v2"},
    {"k":"v",
 "k2":"v2"},
    {"k":"v", "k2":"v2"},   # Note this was untouched because it's now out of the 3 line range that was "selected"

Expected behavior
The changes should be applied to the lines visual selected (even if they grow to exceed the selected block). If I instead of selecting the 3 lines, I also visual some whitespace below the output works because the selected range is big enough for the 3 lines to "grow" into (ie >= 6 lines in this case)...

Expected:

    {"k":"v",
 "k2":"v2"},
    {"k":"v",
 "k2":"v2"},
    {"k":"v",
 "k2":"v2"},

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • Extension Name: vim
  • Extension Version: 0.16.0
  • OS Version: Darwin x64 17.5.0
  • VSCode version: 1.25.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 issue in the VSCodeVim extension using the three-line visual selection and :s/",/",\r/g command described above. Trace the visual-range substitution handling and verify that all originally selected lines are changed even when each replacement adds a line; confirm the expected final state from the report.

Written by the indexing model from the issue text.

Assessment

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