add bindings for refreshing the peers view
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
b620ad6ea6
commit
febde4aeba
4
main.go
4
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},
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
6
view.go
6
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
|
||||
|
|
Loading…
Reference in New Issue