From 9b947b74a2170a9a89a6f6e9bdf8772bd7e4ee85 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 18 Apr 2022 09:41:40 +1000 Subject: [PATCH] allow hiding bottom line --- docs/Config.md | 1 + pkg/config/user_config.go | 2 ++ pkg/gui/arrangement.go | 8 +++++++- pkg/gui/information_panel.go | 6 ++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/Config.md b/docs/Config.md index ef3ce6654..c78580471 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -50,6 +50,7 @@ gui: showFileTree: true # for rendering changes files in a tree format showListFooter: true # for seeing the '5 of 20' message in list panels showRandomTip: true + showBottomLine: true # for hiding the bottom information line (unless it has important information to tell you) showCommandLog: true commandLogSize: 8 git: diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index c4758d9df..db913df1b 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -43,6 +43,7 @@ type GuiConfig struct { ShowFileTree bool `yaml:"showFileTree"` ShowRandomTip bool `yaml:"showRandomTip"` ShowCommandLog bool `yaml:"showCommandLog"` + ShowBottomLine bool `yaml:"showBottomLine"` CommandLogSize int `yaml:"commandLogSize"` } @@ -351,6 +352,7 @@ func GetDefaultConfig() *UserConfig { SkipNoStagedFilesWarning: false, ShowListFooter: true, ShowCommandLog: true, + ShowBottomLine: true, ShowFileTree: true, ShowRandomTip: true, CommandLogSize: 8, diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go index 11336946f..de8c9247f 100644 --- a/pkg/gui/arrangement.go +++ b/pkg/gui/arrangement.go @@ -170,6 +170,12 @@ func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map extrasWindowSize := gui.getExtrasWindowSize(height) + showInfoSection := gui.c.UserConfig.Gui.ShowBottomLine || (gui.State.Searching.isSearching || gui.isAnyModeActive()) + infoSectionSize := 0 + if showInfoSection { + infoSectionSize = 1 + } + root := &boxlayout.Box{ Direction: boxlayout.ROW, Children: []*boxlayout.Box{ @@ -201,7 +207,7 @@ func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map }, { Direction: boxlayout.COLUMN, - Size: 1, + Size: infoSectionSize, Children: gui.infoSectionChildren(informationStr, appStatus), }, }, diff --git a/pkg/gui/information_panel.go b/pkg/gui/information_panel.go index 4527da43b..b6c9b7f4b 100644 --- a/pkg/gui/information_panel.go +++ b/pkg/gui/information_panel.go @@ -28,6 +28,12 @@ func (gui *Gui) getActiveMode() (modeStatus, bool) { }) } +func (gui *Gui) isAnyModeActive() bool { + return slices.Some(gui.modeStatuses(), func(mode modeStatus) bool { + return mode.isActive() + }) +} + func (gui *Gui) handleInfoClick() error { if !gui.g.Mouse { return nil