Skip to content

project_panel: Fix mixed sort with incorrect ordering when same file and dir name#47863

Merged
smitbarmase merged 1 commit intozed-industries:mainfrom
f1729:fix-project-panel-mixed-sort-case
Feb 16, 2026
Merged

project_panel: Fix mixed sort with incorrect ordering when same file and dir name#47863
smitbarmase merged 1 commit intozed-industries:mainfrom
f1729:fix-project-panel-mixed-sort-case

Conversation

@f1729
Copy link
Copy Markdown
Contributor

@f1729 f1729 commented Jan 28, 2026

Closes #47678

When using mixed sort mode in the project panel, a folder and file with the same name but different case (e.g., hello folder and Hello.txt file) would sort incorrectly. The file could appear between an expanded folder and its contents.

The issue was in compare_rel_paths_mixed: the tie-breaker logic used case-sensitive comparison (a == b) to decide directory-before-file ordering, but natural_sort_no_tiebreak already considers entries equal case-insensitively. Changed to use eq_ignore_ascii_case to match.

Release Notes:

  • Fixed project panel mixed sort mode ordering incorrectly when a file and folder share the same name with different casing.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 28, 2026
@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jan 28, 2026
When using mixed sort mode in the project panel, a folder and file
with the same name but different case (e.g., 'hello' folder and
'Hello.txt' file) would sort incorrectly. The file could appear
between an expanded folder and its contents.

The issue was in compare_rel_paths_mixed: the tie-breaker logic used
case-sensitive comparison (a == b) to decide directory-before-file
ordering, but natural_sort_no_tiebreak already considers entries
equal case-insensitively. Changed to use eq_ignore_ascii_case to
match.

Fixes zed-industries#47678
@smitbarmase smitbarmase changed the title Fix project panel mixed sort with same-name file and folder project_panel: Fix project panel mixed sort with same-name file and folder Feb 16, 2026
@smitbarmase smitbarmase force-pushed the fix-project-panel-mixed-sort-case branch from 5cb4ddb to 1d9a266 Compare February 16, 2026 13:20
Copy link
Copy Markdown
Member

@smitbarmase smitbarmase left a comment

Choose a reason for hiding this comment

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

Thanks! Clean fix. Rebased on latest main.

@smitbarmase smitbarmase changed the title project_panel: Fix project panel mixed sort with same-name file and folder project_panel: Fix mixed sort with incorrect ordering when same file and dir name Feb 16, 2026
@smitbarmase smitbarmase merged commit 27ab898 into zed-industries:main Feb 16, 2026
37 checks passed
@f1729 f1729 deleted the fix-project-panel-mixed-sort-case branch February 16, 2026 21:25
rtfeldman pushed a commit that referenced this pull request Feb 17, 2026
…and dir name (#47863)

Closes #47678

When using mixed sort mode in the project panel, a folder and file with
the same name but different case (e.g., `hello` folder and `Hello.txt`
file) would sort incorrectly. The file could appear between an expanded
folder and its contents.

The issue was in `compare_rel_paths_mixed`: the tie-breaker logic used
case-sensitive comparison (`a == b`) to decide directory-before-file
ordering, but `natural_sort_no_tiebreak` already considers entries equal
case-insensitively. Changed to use `eq_ignore_ascii_case` to match.

Release Notes:

- Fixed project panel mixed sort mode ordering incorrectly when a file
and folder share the same name with different casing.
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 first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sort Mode Mixed folder out of order when expanded with same name file (capitalized) in same directory

2 participants