Order directories first when using reverse sort (#2269)

* Order directories first when using reverse sort

* Update `CHANGELOG.md`
This commit is contained in:
Joe Lim authored and GitHub committed 2025-11-18 10:58:08 +11:00
1 parent c320102865
commit 5749c9cd93
2 files changed
+2 -1

No files matched your search

+1 -1
View File
@@ -340,7 +340,7 @@ func (dir *dir) sort() {
// when sorting by size while also showing dircounts, we always display files
// and directories separately to avoid mixing file sizes and file counts
if dir.dirfirst || (dir.sortby == sizeSort && dir.dircounts) {
applySort(func(f1, f2 *file) int {
slices.SortStableFunc(dir.files, func(f1, f2 *file) int {
switch {
case f1.IsDir() && !f2.IsDir():
return -1