diff --git a/nav.go b/nav.go index f8dd4c8d..39b8436b 100644 --- a/nav.go +++ b/nav.go @@ -279,15 +279,6 @@ func (dir *dir) sort() { } sort.SliceStable(dir.files, lessfun) - 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 dir.files[i].IsDir() - }) - } - // 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 @@ -306,6 +297,13 @@ func (dir *dir) sort() { } return dir.files[len(dir.files):] }() + } 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 dir.files[i].IsDir() + }) } // when hidden option is disabled, we move hidden files to the