diff --git a/keys.go b/keys.go index 047a7cc..107c905 100644 --- a/keys.go +++ b/keys.go @@ -17,7 +17,7 @@ func (vc *ViewController) CursorUp(g *gocui.Gui, v *gocui.View) error { } func (vc *ViewController) CursorDown(g *gocui.Gui, v *gocui.View) error { - peers := vc.Data.(*PeersState).list + peers := vc.State.(*PeersState).list _, cy := v.Cursor() // Don't go beyond available list of peers if cy+1 >= len(peers) { diff --git a/main.go b/main.go index 7143bab..f41f388 100644 --- a/main.go +++ b/main.go @@ -38,7 +38,9 @@ func main() { Current: true, SelFgColor: gocui.ColorBlack, SelBgColor: gocui.ColorGreen, - Data: peers, + // extra field for view state + State: peers, + // corner positions TopLeft: func(mx, my int) (int, int) { return 0, 0 }, @@ -56,6 +58,7 @@ func main() { Name: "info", Title: "Details", Placeholder: "Loading details...", + // corner positions TopLeft: func(mx, my int) (int, int) { return 0, my/2 + 1 }, diff --git a/view.go b/view.go index 328adc1..dc53adb 100644 --- a/view.go +++ b/view.go @@ -19,7 +19,7 @@ type ViewController struct { SelFgColor gocui.Attribute Keybindings []Binding Manager ViewManager - Data interface{} + State interface{} } type ViewManager struct {