From 8430b04492e74b760fc92fc65a619e46e61d3a6a Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 12 Aug 2020 22:18:03 +1000 Subject: [PATCH] allow configurable main panel split --- docs/Config.md | 1 + pkg/config/app_config.go | 1 + pkg/gui/arrangement.go | 13 +++++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/Config.md b/docs/Config.md index 14da960ec..aa84c980d 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -15,6 +15,7 @@ Default path for the config file: scrollPastBottom: true # enable scrolling past the bottom sidePanelWidth: 0.3333 # number from 0 to 1 expandFocusedSidePanel: false + mainPanelSplitMode: 'flexible' # one of 'horizontal' | 'flexible' | 'vertical' theme: lightTheme: false # For terminals with a light background activeBorderColor: diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 668bc3477..7509df1c3 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -247,6 +247,7 @@ func GetDefaultConfig() []byte { skipStashWarning: true sidePanelWidth: 0.3333 expandFocusedSidePanel: false + mainPanelSplitMode: 'flexible' # one of 'horizontal' | 'flexible' | 'vertical' theme: lightTheme: false activeBorderColor: diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go index aeb6ce59d..9380465a2 100644 --- a/pkg/gui/arrangement.go +++ b/pkg/gui/arrangement.go @@ -132,10 +132,19 @@ func (gui *Gui) getViewDimensions(informationStr string, appStatus string) map[s }, { conditionalDirection: func(width int, height int) int { - if width < 160 && height > 30 { // 2 80 character width panels + mainPanelSplitMode := gui.Config.GetUserConfig().GetString("gui.mainPanelSplitMode") + + switch mainPanelSplitMode { + case "vertical": return ROW - } else { + case "horizontal": return COLUMN + default: + if width < 160 && height > 30 { // 2 80 character width panels + return ROW + } else { + return COLUMN + } } }, direction: COLUMN,