mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
dont store cyclable views in state
This commit is contained in:
parent
dfff845469
commit
d964c59df0
2 changed files with 14 additions and 15 deletions
|
|
@ -36,7 +36,6 @@ type Gui struct {
|
||||||
statusManager *statusManager
|
statusManager *statusManager
|
||||||
T *tasks.TaskManager
|
T *tasks.TaskManager
|
||||||
ErrorChan chan error
|
ErrorChan chan error
|
||||||
CyclableViews []string
|
|
||||||
Views Views
|
Views Views
|
||||||
|
|
||||||
// if we've suspended the gui (e.g. because we've switched to a subprocess)
|
// if we've suspended the gui (e.g. because we've switched to a subprocess)
|
||||||
|
|
@ -138,8 +137,6 @@ func NewGui(log *logrus.Entry, dockerCommand *commands.DockerCommand, oSCommand
|
||||||
ErrorChan: errorChan,
|
ErrorChan: errorChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.CyclableViews = gui.sideViewNames()
|
|
||||||
|
|
||||||
deadlock.Opts.Disable = !gui.Config.Debug
|
deadlock.Opts.Disable = !gui.Config.Debug
|
||||||
deadlock.Opts.DeadlockTimeout = 5 * time.Second
|
deadlock.Opts.DeadlockTimeout = 5 * time.Second
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,18 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (gui *Gui) nextView(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) nextView(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
sideViewNames := gui.sideViewNames()
|
||||||
var focusedViewName string
|
var focusedViewName string
|
||||||
if v == nil || v.Name() == gui.CyclableViews[len(gui.CyclableViews)-1] {
|
if v == nil || v.Name() == sideViewNames[len(sideViewNames)-1] {
|
||||||
focusedViewName = gui.CyclableViews[0]
|
focusedViewName = sideViewNames[0]
|
||||||
} else {
|
} else {
|
||||||
viewName := v.Name()
|
viewName := v.Name()
|
||||||
for i := range gui.CyclableViews {
|
for i := range sideViewNames {
|
||||||
if viewName == gui.CyclableViews[i] {
|
if viewName == sideViewNames[i] {
|
||||||
focusedViewName = gui.CyclableViews[i+1]
|
focusedViewName = sideViewNames[i+1]
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if i == len(gui.CyclableViews)-1 {
|
if i == len(sideViewNames)-1 {
|
||||||
gui.Log.Info("not in list of views")
|
gui.Log.Info("not in list of views")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -37,17 +38,18 @@ func (gui *Gui) nextView(g *gocui.Gui, v *gocui.View) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) previousView(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) previousView(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
sideViewNames := gui.sideViewNames()
|
||||||
var focusedViewName string
|
var focusedViewName string
|
||||||
if v == nil || v.Name() == gui.CyclableViews[0] {
|
if v == nil || v.Name() == sideViewNames[0] {
|
||||||
focusedViewName = gui.CyclableViews[len(gui.CyclableViews)-1]
|
focusedViewName = sideViewNames[len(sideViewNames)-1]
|
||||||
} else {
|
} else {
|
||||||
viewName := v.Name()
|
viewName := v.Name()
|
||||||
for i := range gui.CyclableViews {
|
for i := range sideViewNames {
|
||||||
if viewName == gui.CyclableViews[i] {
|
if viewName == sideViewNames[i] {
|
||||||
focusedViewName = gui.CyclableViews[i-1]
|
focusedViewName = sideViewNames[i-1]
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if i == len(gui.CyclableViews)-1 {
|
if i == len(sideViewNames)-1 {
|
||||||
gui.Log.Info("not in list of views")
|
gui.Log.Info("not in list of views")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue