From abb276f6f19fcdf414bb17e2a1dd4c800586282b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 26 Jun 2019 19:57:02 -0400 Subject: [PATCH] rename extra field in ViewController to State MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- keys.go | 2 +- main.go | 5 ++++- view.go | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) 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 {