From b31607250d02aa4147ee0e7ec45fc41bdcd7adac Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 5 Mar 2025 13:11:31 +0100 Subject: [PATCH] Fix layout of options view for non-english languages The width calculations didn't take multi-byte characters into account. --- pkg/gui/options_map.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/gui/options_map.go b/pkg/gui/options_map.go index e25bf6411..4f9836551 100644 --- a/pkg/gui/options_map.go +++ b/pkg/gui/options_map.go @@ -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()