diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-03-23 22:41:24 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-04-30 13:19:53 +1000 |
commit | ea4587a3b8b824f3090203e438458ad9b627fb19 (patch) | |
tree | c965674f0bcaac584e43a78f6b8971945f485829 /pkg/gui/layout.go | |
parent | 2da300f2fbcb188783ce9a5384fe1d10c75461f9 (diff) |
move some methods
Diffstat (limited to 'pkg/gui/layout.go')
-rw-r--r-- | pkg/gui/layout.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index 2f51b7432..30177ac2f 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -4,6 +4,7 @@ import ( "github.com/jesseduffield/generics/slices" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/gui/context" + "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/theme" ) @@ -95,7 +96,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { gui.Views.Tooltip.Visible = gui.Views.Menu.Visible && gui.Views.Tooltip.Buffer() != "" - for _, context := range gui.TransientContexts() { + for _, context := range gui.transientContexts() { view, err := gui.g.View(context.GetViewName()) if err != nil && !gocui.IsUnknownView(err) { return err @@ -188,6 +189,16 @@ func (gui *Gui) onInitialViewsCreationForRepo() error { return gui.loadNewRepo() } +func (gui *Gui) popupViewNames() []string { + popups := slices.Filter(gui.State.Contexts.Flatten(), func(c types.Context) bool { + return c.GetKind() == types.PERSISTENT_POPUP || c.GetKind() == types.TEMPORARY_POPUP + }) + + return slices.Map(popups, func(c types.Context) string { + return c.GetViewName() + }) +} + func (gui *Gui) onInitialViewsCreation() error { // now we order the views (in order of bottom first) for _, view := range gui.orderedViews() { @@ -266,3 +277,9 @@ func (gui *Gui) onViewFocusLost(oldView *gocui.View) error { return nil } + +func (gui *Gui) transientContexts() []types.Context { + return slices.Filter(gui.State.Contexts.Flatten(), func(context types.Context) bool { + return context.IsTransient() + }) +} |