diff --git a/CHANGELOG.md b/CHANGELOG.md index d458cc1a..0b7002bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/nav.go b/nav.go index 46aefd65..9b7c6018 100644 --- a/nav.go +++ b/nav.go @@ -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