From dc163bfc4d0117f157a56534627d8d542cb37a97 Mon Sep 17 00:00:00 2001 From: Art V Date: Mon, 14 Nov 2022 00:53:55 +0300 Subject: [PATCH 1/2] [#2258] show bottom line when having status --- pkg/gui/app_status_manager.go | 4 ++++ pkg/gui/arrangement.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/gui/app_status_manager.go b/pkg/gui/app_status_manager.go index c2d72c5ac..097a19438 100644 --- a/pkg/gui/app_status_manager.go +++ b/pkg/gui/app_status_manager.go @@ -82,6 +82,10 @@ func (m *statusManager) getStatusString() string { return topStatus.message } +func (m *statusManager) showStatus() bool { + return len(m.statuses) > 0 +} + func (gui *Gui) toast(message string) { gui.statusManager.addToastStatus(message) diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go index ecff17893..34004b1df 100644 --- a/pkg/gui/arrangement.go +++ b/pkg/gui/arrangement.go @@ -31,7 +31,7 @@ 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()) + showInfoSection := gui.c.UserConfig.Gui.ShowBottomLine || gui.State.Searching.isSearching || gui.isAnyModeActive() || gui.statusManager.showStatus() infoSectionSize := 0 if showInfoSection { infoSectionSize = 1 From c53752a5f91189687d600a441136683a663f9564 Mon Sep 17 00:00:00 2001 From: Art V Date: Mon, 14 Nov 2022 01:04:56 +0300 Subject: [PATCH 2/2] [#2258] hide options panel when showBottom line is disabled --- pkg/gui/arrangement.go | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go index 34004b1df..ac6f2d9c1 100644 --- a/pkg/gui/arrangement.go +++ b/pkg/gui/arrangement.go @@ -159,30 +159,26 @@ func (gui *Gui) infoSectionChildren(informationStr string, appStatus string) []* } } - result := []*boxlayout.Box{} + appStatusBox := &boxlayout.Box{Window: "appStatus"} + optionsBox := &boxlayout.Box{Window: "options"} - if len(appStatus) > 0 { - result = append(result, - &boxlayout.Box{ - Window: "appStatus", - Size: runewidth.StringWidth(appStatus) + runewidth.StringWidth(INFO_SECTION_PADDING), - }, - ) + if !gui.c.UserConfig.Gui.ShowBottomLine { + optionsBox.Weight = 0 + appStatusBox.Weight = 1 + } else { + optionsBox.Weight = 1 + appStatusBox.Size = runewidth.StringWidth(INFO_SECTION_PADDING) + runewidth.StringWidth(appStatus) } - result = append(result, - []*boxlayout.Box{ - { - Window: "options", - Weight: 1, - }, - { - Window: "information", - // unlike appStatus, informationStr has various colors so we need to decolorise before taking the length - Size: runewidth.StringWidth(INFO_SECTION_PADDING) + runewidth.StringWidth(utils.Decolorise(informationStr)), - }, - }..., - ) + result := []*boxlayout.Box{appStatusBox, optionsBox} + + if gui.c.UserConfig.Gui.ShowBottomLine || gui.isAnyModeActive() { + result = append(result, &boxlayout.Box{ + Window: "information", + // unlike appStatus, informationStr has various colors so we need to decolorise before taking the length + Size: runewidth.StringWidth(INFO_SECTION_PADDING) + runewidth.StringWidth(utils.Decolorise(informationStr)), + }) + } return result }