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
View File
@@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- Filtering is fixed when using special characters in the search pattern if the `filtermethod` is `text` (#2231).
- Custom commands that output messages (e.g. `cmd greet echo 'hello world'`) now display properly (#2245).
- Errors in config files are now displayed properly (#2246).
- Directories are now ordered above files when sorting in reverse with `dirfirst` enabled (#2269).
## [r38](https://github.com/gokcehan/lf/releases/tag/r38)
+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