Fixed the Go("-") behaviour when no history is defined making it go to the root.
This commit is contained in:
parent
84419940e3
commit
61cc2d1df1
1 changed files with 7 additions and 3 deletions
|
@ -178,9 +178,13 @@ func (c *Context) Go(pth Path, args ...any) {
|
||||||
var back bool
|
var back bool
|
||||||
if pth == "-" {
|
if pth == "-" {
|
||||||
ln := len(c.pathHistory)
|
ln := len(c.pathHistory)
|
||||||
pth = c.pathHistory[ln-2]
|
if ln <= 1 {
|
||||||
c.pathHistory = c.pathHistory[:ln-1]
|
pth = "/"
|
||||||
back = true
|
} else {
|
||||||
|
pth = c.pathHistory[ln-2]
|
||||||
|
c.pathHistory = c.pathHistory[:ln-1]
|
||||||
|
back = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Getting the screen and changing to
|
// Getting the screen and changing to
|
||||||
// then executing its widget.
|
// then executing its widget.
|
||||||
|
|
Loading…
Reference in a new issue