rename extra field in ViewController to State
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
197679f10c
commit
abb276f6f1
2
keys.go
2
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 {
|
func (vc *ViewController) CursorDown(g *gocui.Gui, v *gocui.View) error {
|
||||||
peers := vc.Data.(*PeersState).list
|
peers := vc.State.(*PeersState).list
|
||||||
_, cy := v.Cursor()
|
_, cy := v.Cursor()
|
||||||
// Don't go beyond available list of peers
|
// Don't go beyond available list of peers
|
||||||
if cy+1 >= len(peers) {
|
if cy+1 >= len(peers) {
|
||||||
|
|
5
main.go
5
main.go
|
@ -38,7 +38,9 @@ func main() {
|
||||||
Current: true,
|
Current: true,
|
||||||
SelFgColor: gocui.ColorBlack,
|
SelFgColor: gocui.ColorBlack,
|
||||||
SelBgColor: gocui.ColorGreen,
|
SelBgColor: gocui.ColorGreen,
|
||||||
Data: peers,
|
// extra field for view state
|
||||||
|
State: peers,
|
||||||
|
// corner positions
|
||||||
TopLeft: func(mx, my int) (int, int) {
|
TopLeft: func(mx, my int) (int, int) {
|
||||||
return 0, 0
|
return 0, 0
|
||||||
},
|
},
|
||||||
|
@ -56,6 +58,7 @@ func main() {
|
||||||
Name: "info",
|
Name: "info",
|
||||||
Title: "Details",
|
Title: "Details",
|
||||||
Placeholder: "Loading details...",
|
Placeholder: "Loading details...",
|
||||||
|
// corner positions
|
||||||
TopLeft: func(mx, my int) (int, int) {
|
TopLeft: func(mx, my int) (int, int) {
|
||||||
return 0, my/2 + 1
|
return 0, my/2 + 1
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue