summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-03-04 00:08:34 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-03-04 00:12:23 +1100
commit31e201ca52a37cb75386931fe8f74911c0b1e528 (patch)
tree5a5dedb8eb32e80c984b64868e9729b069fc7711
parent0abd7ad6be1e398f4a39c8a8d983e28eaa44d59c (diff)
allow configuring side panel widthv0.16.1v0.16
-rw-r--r--docs/Config.md1
-rw-r--r--pkg/config/app_config.go1
-rw-r--r--pkg/gui/gui.go4
3 files changed, 5 insertions, 1 deletions
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: