Skip to content

helix: Fix normal-mode selection expansion during vim::Scroll commands#47024

Merged
dinocosta merged 2 commits intozed-industries:mainfrom
jrobsonchase:fix-helix-selection-scroll
Jan 26, 2026
Merged

helix: Fix normal-mode selection expansion during vim::Scroll commands#47024
dinocosta merged 2 commits intozed-industries:mainfrom
jrobsonchase:fix-helix-selection-scroll

Conversation

@jrobsonchase
Copy link
Contributor

@jrobsonchase jrobsonchase commented Jan 16, 2026

Fixes the vim::ScrollUp/Down commands when a normal-mode vim or helix selection exists.

Pretty straightforward: make the scroll_editor function aware of the current vim/helix mode, and only expand the selection if a visual mode is active.

Closes #47022

Release Notes:

  • Fixed bug causing normal-mode vim/helix selections to get expanded during vim::Scroll commands

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 16, 2026
@jrobsonchase jrobsonchase changed the title helix: Fix vim scroll commands helix: Fix selection expansion during vim::Scroll commands Jan 16, 2026
@jrobsonchase jrobsonchase changed the title helix: Fix selection expansion during vim::Scroll commands modal editing: Fix normal-mode selection expansion during vim::Scroll commands Jan 16, 2026
@mchisolm0
Copy link
Collaborator

When I build this, I still see the issue. Am I missing something or should the condition check be something like this?

let is_helix_mode = matches!(mode, Mode::HelixNormal | Mode::HelixSelect);
if selection.is_empty() || is_helix_mode {
    selection.collapse_to(new_head, goal)
} else {
    selection.set_head(new_head, goal)
};

@jrobsonchase
Copy link
Contributor Author

That isn't quite correct - I expect it to expand the selection if you're in select mode, which is helix's visual mode. I think that would miss vim's normal mode as well, and you'd still see selection expansion if you make it with the mouse and then use the scroll commands.

What situation are you still seeing the incorrect behavior in?

@jrobsonchase jrobsonchase force-pushed the fix-helix-selection-scroll branch from 36ad3a8 to 96cf4fa Compare January 19, 2026 15:41
@jrobsonchase
Copy link
Contributor Author

Updated the test to ensure that the selection does get extended in helix select mode.

Copy link
Member

@dinocosta dinocosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jrobsonchase 👋

Thank you so much for fixing this and including tests for it too! I've left a single comment regarding the test, as I believe there's a place where state is being set where the intent might have been to actually assert state.

Let me know if you have any questions! 🙂

@jrobsonchase jrobsonchase force-pushed the fix-helix-selection-scroll branch from 96cf4fa to 2c21d5a Compare January 23, 2026 15:32
@jrobsonchase jrobsonchase force-pushed the fix-helix-selection-scroll branch from 2c21d5a to 765fb59 Compare January 26, 2026 16:00
Copy link
Member

@dinocosta dinocosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking another look @jrobsonchase ! I've pushed a single commit fixing indentation in one comment, otherwise everything's good to go.

Will merge this shortly. Thanks! 🙂

@dinocosta dinocosta changed the title modal editing: Fix normal-mode selection expansion during vim::Scroll commands helix: Fix normal-mode selection expansion during vim::Scroll commands Jan 26, 2026
@dinocosta dinocosta enabled auto-merge (squash) January 26, 2026 19:46
@dinocosta dinocosta merged commit d1f7c24 into zed-industries:main Jan 26, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helix: selection gets "stuck" during scroll up/down

3 participants