mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
Resize all open popup panels in layout, not just the topmost one
Probably not the most import feature in the world, but when resizing the terminal window while multiple popup panels were open at the same time, we would only resize the topmost one. The main reason for changing this is because it makes the next commit easier to implement.
This commit is contained in:
parent
1d502d3245
commit
1ab1fb3599
5 changed files with 25 additions and 11 deletions
|
@ -391,3 +391,12 @@ func (self *ContextMgr) ContextForKey(key types.ContextKey) types.Context {
|
||||||
|
|
||||||
return nil
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -315,16 +315,16 @@ func (self *ConfirmationHelper) getSelectedSuggestionValue() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *ConfirmationHelper) ResizeCurrentPopupPanel() {
|
func (self *ConfirmationHelper) ResizeCurrentPopupPanels() {
|
||||||
c := self.c.CurrentContext()
|
for _, c := range self.c.CurrentPopupContexts() {
|
||||||
|
switch c {
|
||||||
switch c {
|
case self.c.Contexts().Menu:
|
||||||
case self.c.Contexts().Menu:
|
self.resizeMenu()
|
||||||
self.resizeMenu()
|
case self.c.Contexts().Confirmation, self.c.Contexts().Suggestions:
|
||||||
case self.c.Contexts().Confirmation, self.c.Contexts().Suggestions:
|
self.resizeConfirmationPanel()
|
||||||
self.resizeConfirmationPanel()
|
case self.c.Contexts().CommitMessage, self.c.Contexts().CommitDescription:
|
||||||
case self.c.Contexts().CommitMessage, self.c.Contexts().CommitDescription:
|
self.ResizeCommitMessagePanels()
|
||||||
self.ResizeCommitMessagePanels()
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,10 @@ func (self *guiCommon) CurrentSideContext() types.Context {
|
||||||
return self.gui.State.ContextMgr.CurrentSide()
|
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 {
|
func (self *guiCommon) IsCurrentContext(c types.Context) bool {
|
||||||
return self.gui.State.ContextMgr.IsCurrent(c)
|
return self.gui.State.ContextMgr.IsCurrent(c)
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
||||||
// if you run `lazygit --logs`
|
// if you run `lazygit --logs`
|
||||||
// this will let you see these branches as prettified json
|
// this will let you see these branches as prettified json
|
||||||
// gui.c.Log.Info(utils.AsJson(gui.State.Model.Branches[0:4]))
|
// gui.c.Log.Info(utils.AsJson(gui.State.Model.Branches[0:4]))
|
||||||
gui.helpers.Confirmation.ResizeCurrentPopupPanel()
|
gui.helpers.Confirmation.ResizeCurrentPopupPanels()
|
||||||
|
|
||||||
gui.renderContextOptionsMap()
|
gui.renderContextOptionsMap()
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ type IGuiCommon interface {
|
||||||
CurrentContext() Context
|
CurrentContext() Context
|
||||||
CurrentStaticContext() Context
|
CurrentStaticContext() Context
|
||||||
CurrentSideContext() Context
|
CurrentSideContext() Context
|
||||||
|
CurrentPopupContexts() []Context
|
||||||
IsCurrentContext(Context) bool
|
IsCurrentContext(Context) bool
|
||||||
// TODO: replace the above context-based methods with just using Context() e.g. replace PushContext() with Context().Push()
|
// TODO: replace the above context-based methods with just using Context() e.g. replace PushContext() with Context().Push()
|
||||||
Context() IContextMgr
|
Context() IContextMgr
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue