diff --git a/main.go b/main.go index 36ab0db..498b0fb 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,7 @@ type rcpResp map[string]interface{} const host = "127.0.0.1" const port = 8545 -const interval = 5 +const interval = 3 var threadDone = make(chan struct{}) @@ -71,6 +71,8 @@ func main() { Binding{gocui.KeyCtrlC, gocui.ModNone, quit}, Binding{gocui.KeyArrowUp, gocui.ModNone, mainView.CursorUp}, Binding{gocui.KeyArrowDown, gocui.ModNone, mainView.CursorDown}, + Binding{'r', gocui.ModNone, mainView.Refresh}, + Binding{gocui.KeyCtrlL, gocui.ModNone, mainView.Refresh}, Binding{'k', gocui.ModNone, mainView.CursorUp}, Binding{'j', gocui.ModNone, mainView.CursorDown}, Binding{gocui.KeyDelete, gocui.ModNone, mainView.HandleDelete}, diff --git a/render.go b/render.go index 1901c0c..09b42da 100644 --- a/render.go +++ b/render.go @@ -68,7 +68,7 @@ func updatePeerCursor(g *gocui.Gui, current int) { if err := v.SetCursor(cx, current); err != nil { ox, _ := v.Origin() if err := v.SetOrigin(ox, current); err != nil { - log.Panicln("unable to scroll") + log.Panicln("unable to scroll:", err) } } } diff --git a/view.go b/view.go index 7859f5f..ac18fb1 100644 --- a/view.go +++ b/view.go @@ -91,6 +91,12 @@ func (v *ViewController) SetKeybindings(g *gocui.Gui) error { return nil } +func (vc *ViewController) Refresh(g *gocui.Gui, v *gocui.View) error { + // TODO propper error handling? + vc.StateCtrl.Fetch() + return nil +} + func (vc *ViewController) CursorUp(g *gocui.Gui, v *gocui.View) error { // TODO propper error handling? current := vc.StateCtrl.State.GetData().Current