rename extra field in ViewController to State

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-06-26 19:57:02 -04:00 committed by Jakub
parent 197679f10c
commit abb276f6f1
3 changed files with 6 additions and 3 deletions

View File

@ -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) {

View File

@ -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
},

View File

@ -19,7 +19,7 @@ type ViewController struct {
SelFgColor gocui.Attribute
Keybindings []Binding
Manager ViewManager
Data interface{}
State interface{}
}
type ViewManager struct {