diff --git a/eval.go b/eval.go index 020be46..789f41e 100644 --- a/eval.go +++ b/eval.go @@ -719,16 +719,18 @@ func (e *callExpr) eval(app *app, args []string) { if app.ui.cmdPrefix != "" && app.ui.cmdPrefix != ">" { normal(app) } - app.nav.top() - app.ui.loadFile(app.nav, true) - app.ui.loadFileInfo(app.nav) + if app.nav.top() { + app.ui.loadFile(app.nav, true) + app.ui.loadFileInfo(app.nav) + } case "bottom": if app.ui.cmdPrefix != "" && app.ui.cmdPrefix != ">" { normal(app) } - app.nav.bottom() - app.ui.loadFile(app.nav, true) - app.ui.loadFileInfo(app.nav) + if app.nav.bottom() { + app.ui.loadFile(app.nav, true) + app.ui.loadFileInfo(app.nav) + } case "toggle": if len(e.args) == 0 { app.nav.toggle() diff --git a/nav.go b/nav.go index 6c4b26f..2b25fbf 100644 --- a/nav.go +++ b/nav.go @@ -677,18 +677,26 @@ func (nav *nav) open() error { return nil } -func (nav *nav) top() { +func (nav *nav) top() bool { dir := nav.currDir() + old := dir.ind + dir.ind = 0 dir.pos = 0 + + return old != dir.ind } -func (nav *nav) bottom() { +func (nav *nav) bottom() bool { dir := nav.currDir() + old := dir.ind + dir.ind = len(dir.files) - 1 dir.pos = min(dir.ind, nav.height-1) + + return old != dir.ind } func (nav *nav) toggleSelection(path string) {