summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-19 18:04:00 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-19 18:09:01 +1000
commit926a48a65b1d3325515b915bb422686f49724d56 (patch)
tree23b5c7a94d72f48ec7fa7192fd7639e83d098188
parent98375dc902513a8b0759985a270d8d895cba1199 (diff)
smarter sizing of command log panel
-rw-r--r--pkg/gui/arrangement.go27
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,