mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-21 23:01: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
|
||||
T *tasks.TaskManager
|
||||
ErrorChan chan error
|
||||
CyclableViews []string
|
||||
Views Views
|
||||
|
||||
// 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,
|
||||
}
|
||||
|
||||
gui.CyclableViews = gui.sideViewNames()
|
||||
|
||||
deadlock.Opts.Disable = !gui.Config.Debug
|
||||
deadlock.Opts.DeadlockTimeout = 5 * time.Second
|
||||
|
||||
|
|
|
|||
|
|
@ -12,17 +12,18 @@ import (
|
|||
)
|
||||
|
||||
func (gui *Gui) nextView(g *gocui.Gui, v *gocui.View) error {
|
||||
sideViewNames := gui.sideViewNames()
|
||||
var focusedViewName string
|
||||
if v == nil || v.Name() == gui.CyclableViews[len(gui.CyclableViews)-1] {
|
||||
focusedViewName = gui.CyclableViews[0]
|
||||
if v == nil || v.Name() == sideViewNames[len(sideViewNames)-1] {
|
||||
focusedViewName = sideViewNames[0]
|
||||
} else {
|
||||
viewName := v.Name()
|
||||
for i := range gui.CyclableViews {
|
||||
if viewName == gui.CyclableViews[i] {
|
||||
focusedViewName = gui.CyclableViews[i+1]
|
||||
for i := range sideViewNames {
|
||||
if viewName == sideViewNames[i] {
|
||||
focusedViewName = sideViewNames[i+1]
|
||||
break
|
||||
}
|
||||
if i == len(gui.CyclableViews)-1 {
|
||||
if i == len(sideViewNames)-1 {
|
||||
gui.Log.Info("not in list of views")
|
||||
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 {
|
||||
sideViewNames := gui.sideViewNames()
|
||||
var focusedViewName string
|
||||
if v == nil || v.Name() == gui.CyclableViews[0] {
|
||||
focusedViewName = gui.CyclableViews[len(gui.CyclableViews)-1]
|
||||
if v == nil || v.Name() == sideViewNames[0] {
|
||||
focusedViewName = sideViewNames[len(sideViewNames)-1]
|
||||
} else {
|
||||
viewName := v.Name()
|
||||
for i := range gui.CyclableViews {
|
||||
if viewName == gui.CyclableViews[i] {
|
||||
focusedViewName = gui.CyclableViews[i-1]
|
||||
for i := range sideViewNames {
|
||||
if viewName == sideViewNames[i] {
|
||||
focusedViewName = sideViewNames[i-1]
|
||||
break
|
||||
}
|
||||
if i == len(gui.CyclableViews)-1 {
|
||||
if i == len(sideViewNames)-1 {
|
||||
gui.Log.Info("not in list of views")
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue