Makes the first history position reloadable

This commit is contained in:
sloumdrone 2019-12-06 21:53:21 -08:00
parent 3a226f3769
commit 2c9c00ab8d
1 changed files with 7 additions and 3 deletions

View File

@ -726,10 +726,14 @@ func (c *client) ReloadPage() error {
return fmt.Errorf("There is no page to reload") return fmt.Errorf("There is no page to reload")
} }
url := c.PageState.History[c.PageState.Position].Location.Full url := c.PageState.History[c.PageState.Position].Location.Full
if c.PageState.Length == 1 {
c.PageState.Position--
} else {
err := c.PageState.NavigateHistory(-1) err := c.PageState.NavigateHistory(-1)
if err != nil { if err != nil {
return err return err
} }
}
length := c.PageState.Length length := c.PageState.Length
c.Visit(url) c.Visit(url)
c.PageState.Length = length c.PageState.Length = length