summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-03-23 22:41:24 +1100
committerJesse Duffield <jessedduffield@gmail.com>2023-04-30 13:19:53 +1000
commitea4587a3b8b824f3090203e438458ad9b627fb19 (patch)
treec965674f0bcaac584e43a78f6b8971945f485829 /pkg
parent2da300f2fbcb188783ce9a5384fe1d10c75461f9 (diff)
move some methods
Diffstat (limited to 'pkg')
-rw-r--r--pkg/gui/context_config.go17
-rw-r--r--pkg/gui/layout.go19
2 files changed, 18 insertions, 18 deletions
diff --git a/pkg/gui/context_config.go b/pkg/gui/context_config.go
index a81e01bf5..748482a35 100644
--- a/pkg/gui/context_config.go
+++ b/pkg/gui/context_config.go
@@ -1,7 +1,6 @@
package gui
import (
- "github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@@ -22,16 +21,6 @@ func OnFocusWrapper(f func() error) func(opts types.OnFocusOpts) error {
}
}
-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) defaultSideContext() types.Context {
if gui.State.Modes.Filtering.Active() {
return gui.State.Contexts.LocalCommits
@@ -39,9 +28,3 @@ func (gui *Gui) defaultSideContext() types.Context {
return gui.State.Contexts.Files
}
}
-
-func (gui *Gui) TransientContexts() []types.Context {
- return slices.Filter(gui.State.Contexts.Flatten(), func(context types.Context) bool {
- return context.IsTransient()
- })
-}
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()
+ })
+}