From f66a4a4a2ee2079c2f71323a97ac996f182cd139 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sat, 3 Dec 2016 01:05:49 +0300 Subject: [PATCH] don't override error messages in statusline --- eval.go | 11 +++++++++++ ui.go | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/eval.go b/eval.go index b389eed..c78c573 100644 --- a/eval.go +++ b/eval.go @@ -158,21 +158,27 @@ func (e *CallExpr) eval(app *App, args []string) { case "up": app.nav.up(1) app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) case "half-up": app.nav.up(app.nav.height / 2) app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) case "page-up": app.nav.up(app.nav.height) app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) case "down": app.nav.down(1) app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) case "half-down": app.nav.down(app.nav.height / 2) app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) case "page-down": app.nav.down(app.nav.height) app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) case "updir": if err := app.nav.updir(); err != nil { app.ui.message = err.Error() @@ -180,10 +186,12 @@ func (e *CallExpr) eval(app *App, args []string) { return } app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) case "open": err := app.nav.open() if err == nil { app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) return } if err != ErrNotDir { @@ -228,9 +236,11 @@ func (e *CallExpr) eval(app *App, args []string) { case "bot": app.nav.bot() app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) case "top": app.nav.top() app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) case "read": s := app.ui.prompt(app.nav, ":") if len(s) == 0 { @@ -346,6 +356,7 @@ func (e *CallExpr) eval(app *App, args []string) { return } app.ui.loadFile(app.nav) + app.ui.loadFileInfo(app.nav) case "push": if len(e.args) > 0 { app.ui.keysbuf = append(app.ui.keysbuf, splitKeys(e.args[0])...) diff --git a/ui.go b/ui.go index 72bf632..0709db7 100644 --- a/ui.go +++ b/ui.go @@ -399,13 +399,20 @@ func (ui *UI) renew() { ui.msgwin.renew(wtot, 1, 0, htot-1) } -func (ui *UI) loadFile(nav *Nav) { +func (ui *UI) loadFileInfo(nav *Nav) { curr, err := nav.currFile() if err != nil { return } ui.message = fmt.Sprintf("%v %v %v", curr.Mode(), humanize(curr.Size()), curr.ModTime().Format(gOpts.timefmt)) +} + +func (ui *UI) loadFile(nav *Nav) { + curr, err := nav.currFile() + if err != nil { + return + } if !gOpts.preview { return