project_panel: Fix the confusing display when files or directories have the same name in a case-insensitive comparison (#19211)
- Closes #18851 Release Notes: - Fixed directory name comparison on Linux not considering the case ([#18851](https://github.com/zed-industries/zed/issues/18851))
This commit is contained in:
parent
6c7e79eff6
commit
d53a86b01d
2 changed files with 43 additions and 4 deletions
|
@ -659,15 +659,22 @@ impl<'a> NumericPrefixWithSuffix<'a> {
|
|||
Self(prefix, remainder)
|
||||
}
|
||||
}
|
||||
|
||||
/// When dealing with equality, we need to consider the case of the strings to achieve strict equality
|
||||
/// to handle cases like "a" < "A" instead of "a" == "A".
|
||||
impl Ord for NumericPrefixWithSuffix<'_> {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
match (self.0, other.0) {
|
||||
(None, None) => UniCase::new(self.1).cmp(&UniCase::new(other.1)),
|
||||
(None, None) => UniCase::new(self.1)
|
||||
.cmp(&UniCase::new(other.1))
|
||||
.then_with(|| self.1.cmp(other.1).reverse()),
|
||||
(None, Some(_)) => Ordering::Greater,
|
||||
(Some(_), None) => Ordering::Less,
|
||||
(Some(a), Some(b)) => a
|
||||
.cmp(&b)
|
||||
.then_with(|| UniCase::new(self.1).cmp(&UniCase::new(other.1))),
|
||||
(Some(a), Some(b)) => a.cmp(&b).then_with(|| {
|
||||
UniCase::new(self.1)
|
||||
.cmp(&UniCase::new(other.1))
|
||||
.then_with(|| self.1.cmp(other.1).reverse())
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue