Fixed the Go("-") behaviour when no history is defined making it go to the root.

This commit is contained in:
Andrey Parhomenko 2023-10-06 11:38:52 +03:00
parent 84419940e3
commit 61cc2d1df1

View file

@ -178,10 +178,14 @@ func (c *Context) Go(pth Path, args ...any) {
var back bool
if pth == "-" {
ln := len(c.pathHistory)
if ln <= 1 {
pth = "/"
} else {
pth = c.pathHistory[ln-2]
c.pathHistory = c.pathHistory[:ln-1]
back = true
}
}
// Getting the screen and changing to
// then executing its widget.
if !pth.IsAbs() {