diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-11-14 19:01:26 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 19:01:26 +1100 |
commit | e953659ebff20b621c4535384c585eb44c773a8a (patch) | |
tree | fbdc7153b889f5bff80a900e24b75828f9677ad6 | |
parent | b33ec5a05025a2755f4511f042e9e0fcb224bf47 (diff) | |
parent | c53752a5f91189687d600a441136683a663f9564 (diff) |
Merge pull request #2273 from artvi/fix/show_loading_state_when_bottomline_disabled
-rw-r--r-- | pkg/gui/app_status_manager.go | 4 | ||||
-rw-r--r-- | pkg/gui/arrangement.go | 40 |
2 files changed, 22 insertions, 22 deletions
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..ac6f2d9c1 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 @@ -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 } |