From 31e201ca52a37cb75386931fe8f74911c0b1e528 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 4 Mar 2020 00:08:34 +1100 Subject: allow configuring side panel width --- docs/Config.md | 1 + pkg/config/app_config.go | 1 + pkg/gui/gui.go | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/Config.md b/docs/Config.md index 891b38355..d28f39bf0 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -12,6 +12,7 @@ Default path for the config file: # stuff relating to the UI scrollHeight: 2 # how many lines you scroll by scrollPastBottom: true # enable scrolling past the bottom + sidePanelWidth: 0.3333 # number from 0 to 1 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 2104aa45e..bc79e12ba 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -244,6 +244,7 @@ func GetDefaultConfig() []byte { scrollPastBottom: true mouseEvents: true skipUnstageLineWarning: false + sidePanelWidth: 0.3333 theme: lightTheme: false activeBorderColor: diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 9289c4e31..db3787f7c 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -520,11 +520,13 @@ func (gui *Gui) layout(g *gocui.Gui) error { _, _ = g.SetViewOnBottom("limit") g.DeleteView("limit") + sidePanelWidthRatio := gui.Config.GetUserConfig().GetFloat64("gui.sidePanelWidth") + textColor := theme.GocuiDefaultTextColor var leftSideWidth int switch gui.State.ScreenMode { case SCREEN_NORMAL: - leftSideWidth = width / 3 + leftSideWidth = int(float64(width) * sidePanelWidthRatio) case SCREEN_HALF: leftSideWidth = width / 2 case SCREEN_FULL: -- cgit v1.2.3