Skip to content

Fix wrong selection in outline panel#52673

Merged
dinocosta merged 3 commits intozed-industries:mainfrom
OmChillure:fix-wrong-selection-in-commit-panel
Mar 30, 2026
Merged

Fix wrong selection in outline panel#52673
dinocosta merged 3 commits intozed-industries:mainfrom
OmChillure:fix-wrong-selection-in-commit-panel

Conversation

@OmChillure
Copy link
Copy Markdown
Contributor

Summary

Fix wrong outline selection at heading boundaries in Markdown files.

When clicking headings in the Outline Panel for Markdown, the selected item showed as N-1 (previous heading) instead of N. Root cause: the outline_location() function's sort key prioritized depth over cursor position, causing deeper sections to win even when the cursor was at the exact start of a shallower section.

Fixes #52418

How to Review

  • outline_panel.rs:3395 : Sort key change adding cursor_past_start as primary criterion
  • outline_panel.rs:8094 : New comprehensive test with 8 boundary/nesting cases

Self-Review Checklist

  • Reviewed diff for quality and correctness
  • Tests cover the new/changed behavior (8 test cases added)
  • No unsafe code changes
  • All 12 tests pass (11 existing + 1 new)

Video

Screencast.from.2026-03-26.09-58-23.webm

Note : Reopens previous work from closed PR #52467 (fork was deleted)

Release Notes:

  • Fixed Outline Panel selection being off-by-one at Markdown heading boundaries

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 29, 2026
@zed-codeowner-coordinator zed-codeowner-coordinator bot requested review from a team, Veykril and dinocosta and removed request for a team March 29, 2026 16:31
@zed-community-bot zed-community-bot bot added the guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions label Mar 29, 2026
@OmChillure OmChillure changed the title Fix wrong selection in commit panel Fix wrong selection in outline panel Mar 29, 2026
@Veykril Veykril assigned dinocosta and unassigned Veykril Mar 30, 2026
Copy link
Copy Markdown
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.

Thanks @OmChillure ! 🙂

@dinocosta dinocosta enabled auto-merge (squash) March 30, 2026 11:55
@dinocosta dinocosta merged commit 9649a72 into zed-industries:main Mar 30, 2026
30 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 guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong selection in Outline Panel for MD files

3 participants