fix: fixed the wrong "-" path interpretation in the Go method.

This commit is contained in:
Andrey Parhomenko 2024-01-17 16:56:13 +03:00
parent ab1437a15b
commit 638b1c1f78
2 changed files with 6 additions and 4 deletions

View file

@ -170,10 +170,7 @@ func (compo *CommandCompo) Serve(c *Context) {
c.WithUpdate(u).Run(cmd.Action) c.WithUpdate(u).Run(cmd.Action)
if cmd.Widget != nil { if cmd.Widget != nil {
cmdUpdates.Close() cmdUpdates.Close()
cmdUpdates, err = c.WithUpdate(u).RunWidget(cmd.Widget) cmdUpdates, _ = c.WithUpdate(u).RunWidget(cmd.Widget)
if err != nil {
continue
}
} }
continue continue
} }

View file

@ -232,6 +232,11 @@ func (c *Context) Go(pth Path, args ...any) error {
} }
var back bool var back bool
if pth == "-" { if pth == "-" {
if len(c.pathHistory) < 2 {
return c.Go("")
}
pth = c.pathHistory[len(c.pathHistory)-2]
c.pathHistory = c.pathHistory[:len(c.pathHistory)-1]
} }
// Getting the screen and changing to // Getting the screen and changing to
// then executing its widget. // then executing its widget.