1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-13 01:30:53 +02:00

fix: fix the appStatus width calculation

This commit is contained in:
Ryooooooga
2022-05-07 17:10:38 +09:00
parent 265e6d8360
commit 04babdfb82

View File

@ -5,6 +5,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils" "github.com/jesseduffield/lazygit/pkg/utils"
"github.com/mattn/go-runewidth"
) )
// In this file we use the boxlayout package, along with knowledge about the app's state, // In this file we use the boxlayout package, along with knowledge about the app's state,
@ -78,7 +79,7 @@ func (gui *Gui) infoSectionChildren(informationStr string, appStatus string) []*
return []*boxlayout.Box{ return []*boxlayout.Box{
{ {
Window: "searchPrefix", Window: "searchPrefix",
Size: len(SEARCH_PREFIX), Size: runewidth.StringWidth(SEARCH_PREFIX),
}, },
{ {
Window: "search", Window: "search",
@ -93,7 +94,7 @@ func (gui *Gui) infoSectionChildren(informationStr string, appStatus string) []*
result = append(result, result = append(result,
&boxlayout.Box{ &boxlayout.Box{
Window: "appStatus", Window: "appStatus",
Size: len(appStatus) + len(INFO_SECTION_PADDING), Size: runewidth.StringWidth(appStatus) + runewidth.StringWidth(INFO_SECTION_PADDING),
}, },
) )
} }
@ -107,7 +108,7 @@ func (gui *Gui) infoSectionChildren(informationStr string, appStatus string) []*
{ {
Window: "information", Window: "information",
// unlike appStatus, informationStr has various colors so we need to decolorise before taking the length // unlike appStatus, informationStr has various colors so we need to decolorise before taking the length
Size: len(INFO_SECTION_PADDING) + len(utils.Decolorise(informationStr)), Size: runewidth.StringWidth(INFO_SECTION_PADDING) + runewidth.StringWidth(utils.Decolorise(informationStr)),
}, },
}..., }...,
) )