Skip to content

Commit b316072

Browse files
committed
Fix layout of options view for non-english languages
The width calculations didn't take multi-byte characters into account.
1 parent 6a15a59 commit b316072

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/gui/options_map.go

+3-2
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)