diff options
author | Art V <artvpublic@gmail.com> | 2022-11-14 01:04:56 +0300 |
---|---|---|
committer | Art V <artvpublic@gmail.com> | 2022-11-14 01:04:56 +0300 |
commit | c53752a5f91189687d600a441136683a663f9564 (patch) | |
tree | d8428c131d50e9657ae1d5c41544a4ff009ded5c /pkg | |
parent | dc163bfc4d0117f157a56534627d8d542cb37a97 (diff) |
[#2258] hide options panel when showBottom line is disabled
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/arrangement.go | 38 |
1 files 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 } |