From 09b1daaaded040355b5eb8a9723cab486d668893 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Wed, 18 Apr 2018 21:52:45 +0300 Subject: [PATCH] sort directory preview when options are changed --- eval.go | 10 ++++++++++ ui.go | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/eval.go b/eval.go index 790bda1..e54dabf 100644 --- a/eval.go +++ b/eval.go @@ -20,12 +20,15 @@ func (e *setExpr) eval(app *app, args []string) { case "dirfirst": gOpts.dirfirst = true app.nav.sort() + app.ui.sort() case "nodirfirst": gOpts.dirfirst = false app.nav.sort() + app.ui.sort() case "dirfirst!": gOpts.dirfirst = !gOpts.dirfirst app.nav.sort() + app.ui.sort() case "drawbox": gOpts.drawbox = true app.ui.renew() @@ -47,12 +50,15 @@ func (e *setExpr) eval(app *app, args []string) { case "hidden": gOpts.hidden = true app.nav.sort() + app.ui.sort() case "nohidden": gOpts.hidden = false app.nav.sort() + app.ui.sort() case "hidden!": gOpts.hidden = !gOpts.hidden app.nav.sort() + app.ui.sort() case "ignorecase": gOpts.ignorecase = true case "noignorecase": @@ -68,12 +74,15 @@ func (e *setExpr) eval(app *app, args []string) { case "reverse": gOpts.reverse = true app.nav.sort() + app.ui.sort() case "noreverse": gOpts.reverse = false app.nav.sort() + app.ui.sort() case "reverse!": gOpts.reverse = !gOpts.reverse app.nav.sort() + app.ui.sort() case "smartcase": gOpts.smartcase = true case "nosmartcase": @@ -125,6 +134,7 @@ func (e *setExpr) eval(app *app, args []string) { } gOpts.sortby = e.val app.nav.sort() + app.ui.sort() case "timefmt": gOpts.timefmt = e.val case "ratios": diff --git a/ui.go b/ui.go index 18043cd..fd43df5 100644 --- a/ui.go +++ b/ui.go @@ -449,6 +449,12 @@ func (ui *ui) renew() { ui.menuWin.renew(wtot, 1, 0, htot-2) } +func (ui *ui) sort() { + name := ui.dirPrev.name() + ui.dirPrev.sort() + ui.dirPrev.find(name, ui.wins[0].h) +} + func (ui *ui) print(msg string) { ui.msg = msg log.Print(msg)