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,10 +178,14 @@ 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)
|
||||||
|
if ln <= 1 {
|
||||||
|
pth = "/"
|
||||||
|
} else {
|
||||||
pth = c.pathHistory[ln-2]
|
pth = c.pathHistory[ln-2]
|
||||||
c.pathHistory = c.pathHistory[:ln-1]
|
c.pathHistory = c.pathHistory[:ln-1]
|
||||||
back = true
|
back = true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Getting the screen and changing to
|
// Getting the screen and changing to
|
||||||
// then executing its widget.
|
// then executing its widget.
|
||||||
if !pth.IsAbs() {
|
if !pth.IsAbs() {
|
||||||
|
|
Loading…
Reference in a new issue