Skip to content

editor: Clear previous select mode when clicking on a sticky header#52636

Open
timvermeulen wants to merge 2 commits intozed-industries:mainfrom
timvermeulen:sticky-header-click-clear-selections
Open

editor: Clear previous select mode when clicking on a sticky header#52636
timvermeulen wants to merge 2 commits intozed-industries:mainfrom
timvermeulen:sticky-header-click-clear-selections

Conversation

@timvermeulen
Copy link
Copy Markdown
Contributor

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

- 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:

before.mov

After:

after.mov

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • 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.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 28, 2026
@github-actions github-actions bot added the community champion Issues filed by our amazing community champions! 🫶 label Mar 28, 2026
@zed-codeowner-coordinator 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
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 community champion Issues filed by our amazing community champions! 🫶

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants