Skip to content

Commit 26cb406

Browse files
authored
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.
2 parents 6a15a59 + b316072 commit 26cb406

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/gui/options_map.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ func (self *OptionsMapMgr) formatBindingInfos(bindingInfos []bindingInfo) string
119119
plainText := fmt.Sprintf("%s: %s", info.description, info.key)
120120

121121
// Check if adding the next formatted string exceeds the available width
122-
if i > 0 && length+len(separator)+len(plainText) > width {
122+
textLen := utils.StringWidth(plainText)
123+
if i > 0 && length+len(separator)+textLen > width {
123124
builder.WriteString(theme.OptionsFgColor.Sprint(separator + ellipsis))
124125
break
125126
}
@@ -131,7 +132,7 @@ func (self *OptionsMapMgr) formatBindingInfos(bindingInfos []bindingInfo) string
131132
length += len(separator)
132133
}
133134
builder.WriteString(formatted)
134-
length += len(plainText)
135+
length += textLen
135136
}
136137

137138
return builder.String()

0 commit comments

Comments
 (0)