mirror of
https://github.com/jroimartin/gocui.git
synced 2025-04-24 13:48:51 +08:00
Use ActiveColor in dynamic.go. Fix bug in active.go
This commit is contained in:
parent
463428abda
commit
a109a3641c
@ -27,11 +27,11 @@ func nextView(g *gocui.Gui, v *gocui.View) error {
|
||||
nextIndex := (active + 1) % len(viewArr)
|
||||
name := viewArr[nextIndex]
|
||||
|
||||
v, err := g.View("v2")
|
||||
out, err := g.View("v2")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintln(v, "Going from view "+v.Name()+" to "+name)
|
||||
fmt.Fprintln(out, "Going from view "+v.Name()+" to "+name)
|
||||
|
||||
if _, err := setCurrentViewOnTop(g, name); err != nil {
|
||||
return err
|
||||
|
@ -28,6 +28,8 @@ func main() {
|
||||
defer g.Close()
|
||||
|
||||
g.SetLayout(layout)
|
||||
g.ActiveColor = gocui.ColorRed
|
||||
|
||||
if err := initKeybindings(g); err != nil {
|
||||
log.Panicln(err)
|
||||
}
|
||||
@ -128,15 +130,6 @@ func newView(g *gocui.Gui) error {
|
||||
if _, err := g.SetCurrentView(name); err != nil {
|
||||
return err
|
||||
}
|
||||
v.BgColor = gocui.ColorRed
|
||||
|
||||
if curView >= 0 {
|
||||
cv, err := g.View(views[curView])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cv.BgColor = g.BgColor
|
||||
}
|
||||
|
||||
views = append(views, name)
|
||||
curView = len(views) - 1
|
||||
@ -163,22 +156,9 @@ func nextView(g *gocui.Gui, disableCurrent bool) error {
|
||||
next = 0
|
||||
}
|
||||
|
||||
nv, err := g.View(views[next])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := g.SetCurrentView(views[next]); err != nil {
|
||||
return err
|
||||
}
|
||||
nv.BgColor = gocui.ColorRed
|
||||
|
||||
if disableCurrent && len(views) > 1 {
|
||||
cv, err := g.View(views[curView])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cv.BgColor = g.BgColor
|
||||
}
|
||||
|
||||
curView = next
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user