Visual changes across range terminate when the line count expands
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:
- Enter the following example text:
{"k":"v", "k2":"v2"},
{"k":"v", "k2":"v2"},
{"k":"v", "k2":"v2"},
- Select the 3 lines with visual mode (shift-V)
- Choose a change across the visual set
:s/",/",\r/g(add a new line where you see",) - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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