Added refresh feature
This commit is contained in:
parent
ee9fc8332c
commit
b5fc017978
24
client.go
24
client.go
|
@ -187,6 +187,15 @@ func (c *client) TakeControlInput() {
|
|||
c.SetPercentRead()
|
||||
c.Draw()
|
||||
}
|
||||
case 'R':
|
||||
c.ClearMessage()
|
||||
err := c.ReloadPage()
|
||||
if err != nil {
|
||||
c.SetMessage(err.Error(), false)
|
||||
c.DrawMessage()
|
||||
} else {
|
||||
c.Draw()
|
||||
}
|
||||
case 'B':
|
||||
// open the bookmarks browser
|
||||
c.BookMarks.ToggleOpen()
|
||||
|
@ -987,6 +996,21 @@ func (c *client) Visit(url string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *client) ReloadPage() error {
|
||||
if c.PageState.Length < 1 {
|
||||
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
|
||||
}
|
||||
length := c.PageState.Length
|
||||
c.Visit(url)
|
||||
c.PageState.Length = length
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------\\
|
||||
// + + + F U N C T I O N S + + + \\
|
||||
|
|
Loading…
Reference in New Issue