Repository navigation
Fix Vi visual block operator boundaries - #2172
Open
ViktorBystrov72 wants to merge 1 commit into
Open
ViktorBystrov72 wants to merge 1 commit into
ViktorBystrov72 wants to merge 1 commit into
Conversation
Keep both corners of a visual block selection intact when converting it to clipboard data. Adjusting the upper endpoint as for characterwise ranges changes the selected columns and can omit the final row.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1661.
In Vi visual-block mode,
d,c, andyshift the upper selection endpoint one character left before cutting. At column zero this moves the endpoint onto the previous line, so an operator can remove whole intervening lines instead of the selected rectangle.Only adjust the upper endpoint for characterwise text objects. Block selections keep their original corners, producing the intended remaining text and block clipboard contents.
Added 18 tests through the real
PromptSessionkey-binding path: all three operators, upward/downward selection, multiple columns, a single character, and empty/short lines. All 18 fail on unmodified main and pass with the change.Validation on Python 3.13.13:
All passed. The full suite has 174 passing tests; each mypy run checked 145 source files. Runtime tests were run on macOS; the platform flags above are static checks.
OpenAI Codex assisted with the implementation, regression tests, and PR description. The reported checks were run locally; no human review is claimed.