1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-31 23:19:40 +02:00

Merge pull request #2273 from artvi/fix/show_loading_state_when_bottomline_disabled

This commit is contained in:
Jesse Duffield 2022-11-14 19:01:26 +11:00 committed by GitHub
commit e953659ebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 22 deletions

View File

@ -82,6 +82,10 @@ func (m *statusManager) getStatusString() string {
return topStatus.message return topStatus.message
} }
func (m *statusManager) showStatus() bool {
return len(m.statuses) > 0
}
func (gui *Gui) toast(message string) { func (gui *Gui) toast(message string) {
gui.statusManager.addToastStatus(message) gui.statusManager.addToastStatus(message)

View File

@ -31,7 +31,7 @@ func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map
extrasWindowSize := gui.getExtrasWindowSize(height) 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 infoSectionSize := 0
if showInfoSection { if showInfoSection {
infoSectionSize = 1 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 { if !gui.c.UserConfig.Gui.ShowBottomLine {
result = append(result, optionsBox.Weight = 0
&boxlayout.Box{ appStatusBox.Weight = 1
Window: "appStatus", } else {
Size: runewidth.StringWidth(appStatus) + runewidth.StringWidth(INFO_SECTION_PADDING), optionsBox.Weight = 1
}, appStatusBox.Size = runewidth.StringWidth(INFO_SECTION_PADDING) + runewidth.StringWidth(appStatus)
)
} }
result = append(result, result := []*boxlayout.Box{appStatusBox, optionsBox}
[]*boxlayout.Box{
{ if gui.c.UserConfig.Gui.ShowBottomLine || gui.isAnyModeActive() {
Window: "options", result = append(result, &boxlayout.Box{
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)),
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 return result
} }