1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-04 23:37:41 +02:00

Fix layout of options view for non-english languages (#4359)

- **PR Description**

The width calculations didn't take multi-byte characters into account,
so the options bar was cut off too early for these.

Fixes #4353.
This commit is contained in:
Stefan Haller 2025-03-06 08:22:21 +01:00 committed by GitHub
commit 26cb4060d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -119,7 +119,8 @@ func (self *OptionsMapMgr) formatBindingInfos(bindingInfos []bindingInfo) string
plainText := fmt.Sprintf("%s: %s", info.description, info.key)
// Check if adding the next formatted string exceeds the available width
if i > 0 && length+len(separator)+len(plainText) > width {
textLen := utils.StringWidth(plainText)
if i > 0 && length+len(separator)+textLen > width {
builder.WriteString(theme.OptionsFgColor.Sprint(separator + ellipsis))
break
}
@ -131,7 +132,7 @@ func (self *OptionsMapMgr) formatBindingInfos(bindingInfos []bindingInfo) string
length += len(separator)
}
builder.WriteString(formatted)
length += len(plainText)
length += textLen
}
return builder.String()