1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-02 03:37:14 +02:00

smarter sizing of command log panel

This commit is contained in:
Jesse Duffield 2021-04-19 18:04:00 +10:00
parent 98375dc902
commit 926a48a65b

View File

@ -132,6 +132,24 @@ func (gui *Gui) splitMainPanelSideBySide() bool {
}
}
func (gui *Gui) getExtrasWindowSize(screenHeight int) int {
if !gui.ShowExtrasWindow {
return 0
}
var baseSize int
if gui.currentStaticContext().GetKey() == COMMAND_LOG_CONTEXT_KEY {
baseSize = 1000 // my way of saying 'fill the available space'
} else if screenHeight < 40 {
baseSize = 1
} else {
baseSize = gui.Config.GetUserConfig().Gui.CommandLogSize
}
frameSize := 2
return baseSize + frameSize
}
func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map[string]boxlayout.Dimensions {
width, height := gui.g.Size()
@ -148,14 +166,7 @@ func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map
mainPanelsDirection = boxlayout.COLUMN
}
extrasWindowSize := 0
if gui.ShowExtrasWindow {
frameSize := 2
extrasWindowSize = gui.Config.GetUserConfig().Gui.CommandLogSize + frameSize
if gui.currentStaticContext().GetKey() == COMMAND_LOG_CONTEXT_KEY {
extrasWindowSize = 40
}
}
extrasWindowSize := gui.getExtrasWindowSize(height)
root := &boxlayout.Box{
Direction: boxlayout.ROW,