mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
fix: sort extension excludes directories since only files have extensions (#3582)
This commit is contained in:
parent
a38a5e6377
commit
97d0c6bb23
2 changed files with 8 additions and 4 deletions
|
|
@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
|
|||
|
||||
- Smart-case in interactive `cd` broken due to a typo ([#3540])
|
||||
- Fix shell formatting for non-spread opener rules ([#3532])
|
||||
- `sort extension` excludes directories since only files have extensions ([#3582])
|
||||
- Account for URL covariance in `Url:join()` ([#3514])
|
||||
|
||||
## [v26.1.4]
|
||||
|
|
@ -340,7 +341,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
|
|||
|
||||
### Fixed
|
||||
|
||||
- `before_ext` should exclude directories since only files have extensions ([#2132])
|
||||
- `before_ext` excludes directories since only files have extensions ([#2132])
|
||||
- Element style of `ui.Text` was not applied to the entire area ([#2093])
|
||||
- Incorrect monorepo sub-plugin path resolution ([#2186])
|
||||
- Use `u32` for parsing Linux partition blocks ([#2234])
|
||||
|
|
@ -1605,3 +1606,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
|
|||
[#3541]: https://github.com/sxyazi/yazi/pull/3541
|
||||
[#3561]: https://github.com/sxyazi/yazi/pull/3561
|
||||
[#3566]: https://github.com/sxyazi/yazi/pull/3566
|
||||
[#3582]: https://github.com/sxyazi/yazi/pull/3582
|
||||
|
|
|
|||
|
|
@ -40,12 +40,14 @@ impl FilesSorter {
|
|||
if ord == Ordering::Equal { by_alphabetical(a, b) } else { ord }
|
||||
}),
|
||||
SortBy::Extension => items.sort_unstable_by(|a, b| {
|
||||
let aa = a.url.ext().filter(|_| a.is_file());
|
||||
let bb = b.url.ext().filter(|_| b.is_file());
|
||||
let ord = if self.sensitive {
|
||||
self.cmp(a.url.ext(), b.url.ext(), self.promote(a, b))
|
||||
self.cmp(aa, bb, self.promote(a, b))
|
||||
} else {
|
||||
self.cmp_insensitive(
|
||||
a.url.ext().map_or(&[], |s| s.encoded_bytes()),
|
||||
b.url.ext().map_or(&[], |s| s.encoded_bytes()),
|
||||
aa.map_or(&[], |s| s.encoded_bytes()),
|
||||
bb.map_or(&[], |s| s.encoded_bytes()),
|
||||
self.promote(a, b),
|
||||
)
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue