diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index 2dabcdf0f..b74d45e3f 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -167,19 +167,7 @@ func (gui *Gui) prepareConfirmationPanel(currentView *gocui.View, title, prompt return confirmationView, nil } -func (gui *Gui) onNewPopupPanel() { - viewNames := []string{ - "commitMessage", - "credentials", - "menu", - } - for _, viewName := range viewNames { - _, _ = gui.g.SetViewOnBottom(viewName) // TODO: investigate - } -} - func (gui *Gui) createPopupPanel(opts createPopupPanelOpts) error { - gui.onNewPopupPanel() gui.g.Update(func(g *gocui.Gui) error { // delete the existing confirmation panel if it exists if view, _ := g.View("confirmation"); view != nil { diff --git a/pkg/gui/context.go b/pkg/gui/context.go index 5ab4bfe1b..59fb4965b 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -90,6 +90,13 @@ func (gui *Gui) switchContext(c Context) error { // push onto stack // if we are switching to a side context, remove all other contexts in the stack if c.GetKind() == SIDE_CONTEXT { + for _, stackContext := range gui.State.ContextStack { + if stackContext.GetKey() != c.GetKey() { + if err := gui.deactivateContext(stackContext); err != nil { + return err + } + } + } gui.State.ContextStack = []Context{c} } else { // TODO: think about other exceptional cases diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 9857beac6..1c0178fe8 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -97,7 +97,7 @@ type Gui struct { // when lazygit is opened outside a git directory we want to open to the most // recent repo with the recent repos popup showing showRecentRepos bool - Contexts ContextTree + Contexts ContextTree } // for now the staging panel state, unlike the other panel states, is going to be diff --git a/pkg/gui/side_window.go b/pkg/gui/side_window.go index f3ae24b3a..938123492 100644 --- a/pkg/gui/side_window.go +++ b/pkg/gui/side_window.go @@ -56,11 +56,6 @@ func (gui *Gui) previousSideWindow() error { func (gui *Gui) goToSideWindow(sideViewName string) func(g *gocui.Gui, v *gocui.View) error { return func(g *gocui.Gui, v *gocui.View) error { - err := gui.closePopupPanels() - if err != nil { - gui.Log.Error(err) - return nil - } return gui.switchContextToView(sideViewName) } } diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index a706ee065..df3dc5ece 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -139,16 +139,6 @@ func (gui *Gui) refreshSidePanels(options refreshOptions) error { return nil } -func (gui *Gui) closePopupPanels() error { - gui.onNewPopupPanel() - err := gui.closeConfirmationPrompt(true) - if err != nil { - gui.Log.Error(err) - return err - } - return nil -} - func (gui *Gui) resetOrigin(v *gocui.View) error { _ = v.SetCursor(0, 0) return v.SetOrigin(0, 0)