diff --git a/nav.go b/nav.go index 9b3dc072..b7fc087f 100644 --- a/nav.go +++ b/nav.go @@ -278,12 +278,12 @@ func (dir *dir) sort() { return oldlessfun(j, i) } } - sort.SliceStable(dir.files, lessfun) // when dironly option is enabled, we move files to the beginning of our file // list and then set the beginning of displayed files to the first directory // in the list if dir.dironly { + sort.SliceStable(dir.files, lessfun) sort.SliceStable(dir.files, func(i, j int) bool { if !dir.files[i].IsDir() && !dir.files[j].IsDir() { return i < j @@ -301,7 +301,7 @@ func (dir *dir) sort() { } else if dir.dirfirst { sort.SliceStable(dir.files, func(i, j int) bool { if dir.files[i].IsDir() == dir.files[j].IsDir() { - return i < j + return lessfun(i, j) } return dir.files[i].IsDir() })