From 2c9c00ab8dfeb1d868f2fa5158948641fdd39852 Mon Sep 17 00:00:00 2001 From: sloumdrone Date: Fri, 6 Dec 2019 21:53:21 -0800 Subject: [PATCH 1/2] Makes the first history position reloadable --- client.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index 7a24c94..9eb1962 100644 --- a/client.go +++ b/client.go @@ -726,9 +726,13 @@ func (c *client) ReloadPage() error { return fmt.Errorf("There is no page to reload") } url := c.PageState.History[c.PageState.Position].Location.Full - err := c.PageState.NavigateHistory(-1) - if err != nil { - return err + if c.PageState.Length == 1 { + c.PageState.Position-- + } else { + err := c.PageState.NavigateHistory(-1) + if err != nil { + return err + } } length := c.PageState.Length c.Visit(url) From 275f7928eafd4392b0d1fb04c662662ff01ace7e Mon Sep 17 00:00:00 2001 From: sloumdrone Date: Sat, 7 Dec 2019 22:20:33 -0800 Subject: [PATCH 2/2] Fixes logic to not be based on length, but on position --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index 9eb1962..dcdd8bc 100644 --- a/client.go +++ b/client.go @@ -726,7 +726,7 @@ func (c *client) ReloadPage() error { return fmt.Errorf("There is no page to reload") } url := c.PageState.History[c.PageState.Position].Location.Full - if c.PageState.Length == 1 { + if c.PageState.Position == 0 { c.PageState.Position-- } else { err := c.PageState.NavigateHistory(-1)