editor: Clear previous select mode when clicking on a sticky header - #52636
Merged
cole-miller merged 2 commits intoApr 1, 2026
Merged
Conversation
zed-codeowner-coordinator
Bot
requested review from
a team,
Anthony-Eid and
cole-miller
and removed request for
a team
March 28, 2026 19:38
Member
|
Thanks! |
cole-miller
enabled auto-merge (squash)
April 1, 2026 14:19
Member
|
@zed-zippy approved |
This was referenced Apr 3, 2026
piper-of-dawn
pushed a commit
to piper-of-dawn/zed
that referenced
this pull request
Apr 25, 2026
…ed-industries#52636) Clicking on a sticky header causes `selections.select_ranges([anchor..anchor])` to be called, but this does not clear the editor's `selections.select_mode()`, resulting in possible incorrect selections if this is followed up by a shift-click. This PR fixes that with ```diff - selections.select_ranges([anchor..anchor]); + selections.clear_disjoint(); + selections.set_pending_anchor_range(anchor..anchor, SelectMode::Character); ``` which is essentially what `editor.select(SelectPhase::Begin { ... }, ...)` (i.e. a regular single click in the editor) does as well. Before: https://github.com/user-attachments/assets/bcf2647e-a22a-4866-8975-d29e135df148 After: https://github.com/user-attachments/assets/fb82db51-fef1-4b7c-9954-6e076ae0b176 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed bug that caused clicking on a sticky header to not always properly clear the previous selection.
Zenor27
pushed a commit
to Zenor27/zed
that referenced
this pull request
Jul 4, 2026
…ed-industries#52636) Clicking on a sticky header causes `selections.select_ranges([anchor..anchor])` to be called, but this does not clear the editor's `selections.select_mode()`, resulting in possible incorrect selections if this is followed up by a shift-click. This PR fixes that with ```diff - selections.select_ranges([anchor..anchor]); + selections.clear_disjoint(); + selections.set_pending_anchor_range(anchor..anchor, SelectMode::Character); ``` which is essentially what `editor.select(SelectPhase::Begin { ... }, ...)` (i.e. a regular single click in the editor) does as well. Before: https://github.com/user-attachments/assets/bcf2647e-a22a-4866-8975-d29e135df148 After: https://github.com/user-attachments/assets/fb82db51-fef1-4b7c-9954-6e076ae0b176 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed bug that caused clicking on a sticky header to not always properly clear the previous selection.
jonx
pushed a commit
to jonx/zed-aros
that referenced
this pull request
Jul 17, 2026
…ed-industries#52636) Clicking on a sticky header causes `selections.select_ranges([anchor..anchor])` to be called, but this does not clear the editor's `selections.select_mode()`, resulting in possible incorrect selections if this is followed up by a shift-click. This PR fixes that with ```diff - selections.select_ranges([anchor..anchor]); + selections.clear_disjoint(); + selections.set_pending_anchor_range(anchor..anchor, SelectMode::Character); ``` which is essentially what `editor.select(SelectPhase::Begin { ... }, ...)` (i.e. a regular single click in the editor) does as well. Before: https://github.com/user-attachments/assets/bcf2647e-a22a-4866-8975-d29e135df148 After: https://github.com/user-attachments/assets/fb82db51-fef1-4b7c-9954-6e076ae0b176 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed bug that caused clicking on a sticky header to not always properly clear the previous selection.
pull Bot
pushed a commit
to kliu/zed
that referenced
this pull request
Jul 24, 2026
In zed-industries#52636 I seem to have introduced this bug, where mouse-down on a sticky header followed by an immediate mouse movements sometimes dropped the pending autoscroll request (to jump to the sticky header line): https://github.com/zed-industries/zed/blob/1fcf9749a6ed384ae346ddf2049ae76e0cc430a9/crates/editor/src/scroll.rs#L453 Fixed by exiting early from `mouse_dragged` when `editor.has_autoscroll_request()`. What sometimes happened before this fix: https://github.com/user-attachments/assets/b6dd6650-b5f0-4ea1-ae70-9c4cf69e31a0 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed bug where clicking on a sticky header would sometimes not jump to that line in the editor
0arm
pushed a commit
to 0arm/zed
that referenced
this pull request
Jul 26, 2026
In zed-industries#52636 I seem to have introduced this bug, where mouse-down on a sticky header followed by an immediate mouse movements sometimes dropped the pending autoscroll request (to jump to the sticky header line): https://github.com/zed-industries/zed/blob/1fcf9749a6ed384ae346ddf2049ae76e0cc430a9/crates/editor/src/scroll.rs#L453 Fixed by exiting early from `mouse_dragged` when `editor.has_autoscroll_request()`. What sometimes happened before this fix: https://github.com/user-attachments/assets/b6dd6650-b5f0-4ea1-ae70-9c4cf69e31a0 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed bug where clicking on a sticky header would sometimes not jump to that line in the editor
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
In zed-industries#52636 I seem to have introduced this bug, where mouse-down on a sticky header followed by an immediate mouse movements sometimes dropped the pending autoscroll request (to jump to the sticky header line): https://github.com/zed-industries/zed/blob/4999bd649d54b0758c373f8aac7ed7ebcb2692f2/crates/editor/src/scroll.rs#L453 Fixed by exiting early from `mouse_dragged` when `editor.has_autoscroll_request()`. What sometimes happened before this fix: https://github.com/user-attachments/assets/b6dd6650-b5f0-4ea1-ae70-9c4cf69e31a0 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed bug where clicking on a sticky header would sometimes not jump to that line in the editor
playdohface
pushed a commit
to playdohface/zed
that referenced
this pull request
Aug 29, 2026
In zed-industries#52636 I seem to have introduced this bug, where mouse-down on a sticky header followed by an immediate mouse movements sometimes dropped the pending autoscroll request (to jump to the sticky header line): https://github.com/zed-industries/zed/blob/1fcf9749a6ed384ae346ddf2049ae76e0cc430a9/crates/editor/src/scroll.rs#L453 Fixed by exiting early from `mouse_dragged` when `editor.has_autoscroll_request()`. What sometimes happened before this fix: https://github.com/user-attachments/assets/b6dd6650-b5f0-4ea1-ae70-9c4cf69e31a0 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed bug where clicking on a sticky header would sometimes not jump to that line in the editor
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.
Clicking on a sticky header causes
selections.select_ranges([anchor..anchor])to be called, but this does not clear the editor'sselections.select_mode(), resulting in possible incorrect selections if this is followed up by a shift-click. This PR fixes that withwhich is essentially what
editor.select(SelectPhase::Begin { ... }, ...)(i.e. a regular single click in the editor) does as well.Before:
before.mov
After:
after.mov
Self-Review Checklist:
Release Notes: