don't override error messages in statusline

This commit is contained in:
Gokcehan 2016-12-03 01:05:49 +03:00
parent 721a20269e
commit f66a4a4a2e
2 changed files with 19 additions and 1 deletions

11
eval.go
View File

@ -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])...)

9
ui.go
View File

@ -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