diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-19 18:04:00 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-19 18:09:01 +1000 |
commit | 926a48a65b1d3325515b915bb422686f49724d56 (patch) | |
tree | 23b5c7a94d72f48ec7fa7192fd7639e83d098188 /pkg/gui/arrangement.go | |
parent | 98375dc902513a8b0759985a270d8d895cba1199 (diff) |
smarter sizing of command log panel
Diffstat (limited to 'pkg/gui/arrangement.go')
-rw-r--r-- | pkg/gui/arrangement.go | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go index a788fa8d3..b865850d3 100644 --- a/pkg/gui/arrangement.go +++ b/pkg/gui/arrangement.go @@ -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, |