vim: Fix visual block Shift-I jumping to original cursor after Ctrl-D scroll#50822
Merged
dinocosta merged 3 commits intozed-industries:mainfrom Mar 18, 2026
Merged
vim: Fix visual block Shift-I jumping to original cursor after Ctrl-D scroll#50822dinocosta merged 3 commits intozed-industries:mainfrom
dinocosta merged 3 commits intozed-industries:mainfrom
Conversation
… scroll Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
dinocosta
requested changes
Mar 6, 2026
Member
dinocosta
left a comment
There was a problem hiding this comment.
Hey @cppcoffee 👋
Thank you so much for finding this issue and attempting to fix it! Although the changes do fix the outlined issue, it seems to accidentally introduce a different issue, so I've left some feedback 🙂
Contributor
Author
|
The JSON test data file added. |
* Update `vim::normal::scroll::scroll_editor` to be a method in `Vim`, removing the need to pass it a `&mut Vim`, `&mut Editor` and `Mode` arguments, as those can all be obtained from having access to `&mut Vim`. * Simplify the `vim::visual::test:;test_visual_block_wrapping_selection` test and use `assert_eq` so it's a little bit easier to understand what the final result should be without having to dig into the JSON file for the test.
dinocosta
approved these changes
Mar 18, 2026
Member
dinocosta
left a comment
There was a problem hiding this comment.
Thank you @cppcoffee 🙂
I've pushed a commit with some minor refactoring but everything looks good!
AmaanBilwar
pushed a commit
to AmaanBilwar/zed
that referenced
this pull request
Mar 18, 2026
… scroll (zed-industries#50822) Ensure that the `vim::visual::Vim::visual_block_motion` method is called when `scroll_editor` is called while in Visual Block mode. This fixes an issue where, after getting into `Visual Block` mode, if the user used `ctrl-d` or `ctrl-u` to scroll half of the page, the wrong selection would be made and, if `shift-i` was used to start inserting at the start of the line, a single cursor would be placed at the cursor position where the selection was started, instead of one cursor per each of the selected lines. These changes ensure that we now match Neovim's behavior for the same flow. --------- Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com> Co-authored-by: dino <dinojoaocosta@gmail.com>
AmaanBilwar
pushed a commit
to AmaanBilwar/zed
that referenced
this pull request
Mar 20, 2026
… scroll (zed-industries#50822) Ensure that the `vim::visual::Vim::visual_block_motion` method is called when `scroll_editor` is called while in Visual Block mode. This fixes an issue where, after getting into `Visual Block` mode, if the user used `ctrl-d` or `ctrl-u` to scroll half of the page, the wrong selection would be made and, if `shift-i` was used to start inserting at the start of the line, a single cursor would be placed at the cursor position where the selection was started, instead of one cursor per each of the selected lines. These changes ensure that we now match Neovim's behavior for the same flow. --------- Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com> Co-authored-by: dino <dinojoaocosta@gmail.com>
toshmukhamedov
pushed a commit
to toshmukhamedov/zed
that referenced
this pull request
Mar 20, 2026
… scroll (zed-industries#50822) Ensure that the `vim::visual::Vim::visual_block_motion` method is called when `scroll_editor` is called while in Visual Block mode. This fixes an issue where, after getting into `Visual Block` mode, if the user used `ctrl-d` or `ctrl-u` to scroll half of the page, the wrong selection would be made and, if `shift-i` was used to start inserting at the start of the line, a single cursor would be placed at the cursor position where the selection was started, instead of one cursor per each of the selected lines. These changes ensure that we now match Neovim's behavior for the same flow. --------- Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com> Co-authored-by: dino <dinojoaocosta@gmail.com>
AmaanBilwar
pushed a commit
to AmaanBilwar/zed
that referenced
this pull request
Mar 23, 2026
… scroll (zed-industries#50822) Ensure that the `vim::visual::Vim::visual_block_motion` method is called when `scroll_editor` is called while in Visual Block mode. This fixes an issue where, after getting into `Visual Block` mode, if the user used `ctrl-d` or `ctrl-u` to scroll half of the page, the wrong selection would be made and, if `shift-i` was used to start inserting at the start of the line, a single cursor would be placed at the cursor position where the selection was started, instead of one cursor per each of the selected lines. These changes ensure that we now match Neovim's behavior for the same flow. --------- Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com> Co-authored-by: dino <dinojoaocosta@gmail.com>
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.
Release Notes:
shift-ijumping to the initial cursor position after scrolling withctrl-d/ctrl-uIn Vim mode, press Ctrl+V to enter line selection, press Ctrl+D to start scrolling, then press Shift+I to insert into the newly selected multiple lines.
Current: Jump to the beginning
Expected: Enter multi-line insert mode
before:
2026-03-05.20.47.18.mov
after:
2026-03-05.20.46.41.mov
vim behaviour:
2026-03-05.20.52.53.mov