Automatically load dircounts after enabling it (#2049)

This commit is contained in:
Joe Lim authored and GitHub committed 2025-07-19 14:35:13 +10:00
1 parent f2d5d08952
commit c31b92491f
2 files changed
+13 -1

No files matched your search

+4
View File
@@ -68,6 +68,10 @@ func (e *setExpr) eval(app *app, args []string) {
err = applyBoolOpt(&gOpts.dircache, e) err = applyBoolOpt(&gOpts.dircache, e)
case "dircounts", "nodircounts", "dircounts!": case "dircounts", "nodircounts", "dircounts!":
err = applyBoolOpt(&gOpts.dircounts, e) err = applyBoolOpt(&gOpts.dircounts, e)
if err == nil {
app.nav.renew()
app.ui.loadFile(app, false)
}
case "dirfirst", "nodirfirst", "dirfirst!": case "dirfirst", "nodirfirst", "dirfirst!":
err = applyBoolOpt(&gOpts.dirfirst, e) err = applyBoolOpt(&gOpts.dirfirst, e)
if err == nil { if err == nil {
+9 -1
View File
@@ -625,8 +625,16 @@ func (nav *nav) checkDir(dir *dir) {
nd := newDir(dir.path) nd := newDir(dir.path)
nav.dirChan <- nd nav.dirChan <- nd
}() }()
case dir.dircounts != getDirCounts(dir.path):
dir.loading = true
go func() {
nd := newDir(dir.path)
nav.dirChan <- nd
}()
// Although toggling dircounts can affect sorting, it is already handled by
// reloading the directory which should sort the files anyway, so it is not
// checked below.
case dir.sortby != getSortBy(dir.path) || case dir.sortby != getSortBy(dir.path) ||
dir.dircounts != getDirCounts(dir.path) ||
dir.dirfirst != getDirFirst(dir.path) || dir.dirfirst != getDirFirst(dir.path) ||
dir.dironly != getDirOnly(dir.path) || dir.dironly != getDirOnly(dir.path) ||
dir.hidden != getHidden(dir.path) || dir.hidden != getHidden(dir.path) ||