diff --git a/pkg/gui/context.go b/pkg/gui/context.go index 28ecf2405..5dc6df6a0 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -391,3 +391,12 @@ func (self *ContextMgr) ContextForKey(key types.ContextKey) types.Context { return nil } + +func (self *ContextMgr) PopupContexts() []types.Context { + self.RLock() + defer self.RUnlock() + + return lo.Filter(self.ContextStack, func(context types.Context, _ int) bool { + return context.GetKind() == types.TEMPORARY_POPUP || context.GetKind() == types.PERSISTENT_POPUP + }) +} diff --git a/pkg/gui/controllers/helpers/confirmation_helper.go b/pkg/gui/controllers/helpers/confirmation_helper.go index 2a1a821c2..83e4102ac 100644 --- a/pkg/gui/controllers/helpers/confirmation_helper.go +++ b/pkg/gui/controllers/helpers/confirmation_helper.go @@ -315,16 +315,16 @@ func (self *ConfirmationHelper) getSelectedSuggestionValue() string { return "" } -func (self *ConfirmationHelper) ResizeCurrentPopupPanel() { - c := self.c.CurrentContext() - - switch c { - case self.c.Contexts().Menu: - self.resizeMenu() - case self.c.Contexts().Confirmation, self.c.Contexts().Suggestions: - self.resizeConfirmationPanel() - case self.c.Contexts().CommitMessage, self.c.Contexts().CommitDescription: - self.ResizeCommitMessagePanels() +func (self *ConfirmationHelper) ResizeCurrentPopupPanels() { + for _, c := range self.c.CurrentPopupContexts() { + switch c { + case self.c.Contexts().Menu: + self.resizeMenu() + case self.c.Contexts().Confirmation, self.c.Contexts().Suggestions: + self.resizeConfirmationPanel() + case self.c.Contexts().CommitMessage, self.c.Contexts().CommitDescription: + self.ResizeCommitMessagePanels() + } } } diff --git a/pkg/gui/gui_common.go b/pkg/gui/gui_common.go index 434f4b38b..8a537f2ca 100644 --- a/pkg/gui/gui_common.go +++ b/pkg/gui/gui_common.go @@ -73,6 +73,10 @@ func (self *guiCommon) CurrentSideContext() types.Context { return self.gui.State.ContextMgr.CurrentSide() } +func (self *guiCommon) CurrentPopupContexts() []types.Context { + return self.gui.State.ContextMgr.PopupContexts() +} + func (self *guiCommon) IsCurrentContext(c types.Context) bool { return self.gui.State.ContextMgr.IsCurrent(c) } diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index 077ee3c84..3bf6a7c35 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -173,7 +173,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { // if you run `lazygit --logs` // this will let you see these branches as prettified json // gui.c.Log.Info(utils.AsJson(gui.State.Model.Branches[0:4])) - gui.helpers.Confirmation.ResizeCurrentPopupPanel() + gui.helpers.Confirmation.ResizeCurrentPopupPanels() gui.renderContextOptionsMap() diff --git a/pkg/gui/types/common.go b/pkg/gui/types/common.go index 61c27de49..c6885d717 100644 --- a/pkg/gui/types/common.go +++ b/pkg/gui/types/common.go @@ -67,6 +67,7 @@ type IGuiCommon interface { CurrentContext() Context CurrentStaticContext() Context CurrentSideContext() Context + CurrentPopupContexts() []Context IsCurrentContext(Context) bool // TODO: replace the above context-based methods with just using Context() e.g. replace PushContext() with Context().Push() Context() IContextMgr