Correct other end visual block functionality (#27678)
Closes #27385 Builds on #27604 so that `vim::OtherEnd` works in visual block mode. This is accomplished by reversing the order of active selections in the buffer when the user hit `o`, so that the cursor moves diagonally across the selection. The current behavior is preserved for `shift-o`, which is how the cursors behave in vim. We'll close #27604 since this encapsulates that change, but if you'd prefer to take only the visual block motion component, we'll keep the branch for #27604 open. Test case: growing a box down and to the right, other ending, followed by growing and shrinking the box: https://github.com/user-attachments/assets/1df544e1-efce-4354-b354-bbfec007a7df Test case: growing a box up and to the left, other ending, followed by growing and shrinking the box: https://github.com/user-attachments/assets/2f6d7729-c63a-4486-960b-23474c2e507a Release Notes: - Improved visual block mode when cursor is at beginning of selection - Improved visual block mode so that `o` and `shift-o` reach parity with vim --------- Co-authored-by: KyleBarton <kjbarton4@gmail.com>
This commit is contained in:
parent
4a5c492188
commit
5c0adde7bb
8 changed files with 165 additions and 6 deletions
|
@ -0,0 +1,9 @@
|
|||
{"Put":{"state":"The ˇquick brown\nfox jumps over\nthe lazy dog"}}
|
||||
{"Key":"ctrl-v"}
|
||||
{"Key":"l"}
|
||||
{"Key":"l"}
|
||||
{"Key":"l"}
|
||||
{"Key":"l"}
|
||||
{"Key":"l"}
|
||||
{"Key":"j"}
|
||||
{"Get":{"state":"The «quick ˇ»brown\nfox «jumps ˇ»over\nthe lazy dog","mode":"VisualBlock"}}
|
11
crates/vim/test_data/test_visual_block_mode_other_end.json
Normal file
11
crates/vim/test_data/test_visual_block_mode_other_end.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{"Put":{"state":"The quick brown\nfox jˇumps over\nthe lazy dog"}}
|
||||
{"Key":"ctrl-v"}
|
||||
{"Key":"l"}
|
||||
{"Key":"l"}
|
||||
{"Key":"l"}
|
||||
{"Key":"l"}
|
||||
{"Key":"j"}
|
||||
{"Get":{"state":"The quick brown\nfox j«umps ˇ»over\nthe l«azy dˇ»og","mode":"VisualBlock"}}
|
||||
{"Key":"o"}
|
||||
{"Key":"k"}
|
||||
{"Get":{"state":"The q«ˇuick »brown\nfox j«ˇumps »over\nthe l«ˇazy d»og","mode":"VisualBlock"}}
|
|
@ -0,0 +1,11 @@
|
|||
{"Put":{"state":"The quick brown\nfox jˇumps over\nthe lazy dog"}}
|
||||
{"Key":"ctrl-v"}
|
||||
{"Key":"l"}
|
||||
{"Key":"l"}
|
||||
{"Key":"l"}
|
||||
{"Key":"l"}
|
||||
{"Key":"j"}
|
||||
{"Get":{"state":"The quick brown\nfox j«umps ˇ»over\nthe l«azy dˇ»og","mode":"VisualBlock"}}
|
||||
{"Key":"shift-o"}
|
||||
{"Key":"k"}
|
||||
{"Get":{"state":"The quick brown\nfox j«ˇumps »over\nthe lazy dog","mode":"VisualBlock"}}
|
9
crates/vim/test_data/test_visual_block_mode_up_left.json
Normal file
9
crates/vim/test_data/test_visual_block_mode_up_left.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{"Put":{"state":"The quick brown\nfox jumpsˇ over\nthe lazy dog"}}
|
||||
{"Key":"ctrl-v"}
|
||||
{"Key":"h"}
|
||||
{"Key":"h"}
|
||||
{"Key":"h"}
|
||||
{"Key":"h"}
|
||||
{"Key":"h"}
|
||||
{"Key":"k"}
|
||||
{"Get":{"state":"The «ˇquick »brown\nfox «ˇjumps »over\nthe lazy dog","mode":"VisualBlock"}}
|
Loading…
Add table
Add a link
Reference in a new issue