diff options
Diffstat (limited to 'lib/format/format.go')
-rw-r--r-- | lib/format/format.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/format/format.go b/lib/format/format.go index ca90ac4a..cc9716dd 100644 --- a/lib/format/format.go +++ b/lib/format/format.go @@ -10,6 +10,7 @@ import ( "git.sr.ht/~rjarry/aerc/models" "github.com/emersion/go-message/mail" + "github.com/mattn/go-runewidth" ) // AddressForHumans formats the address. If the address's name @@ -365,6 +366,22 @@ func ParseMessageFormat(format string, timeFmt string, thisDayTimeFmt string, i = ni + 1 } + const zeroWidthSpace rune = '\u200b' + for i, val := range args { + if s, ok := val.(string); ok { + var out strings.Builder + for _, r := range s { + w := runewidth.RuneWidth(r) + for w > 1 { + out.WriteRune(zeroWidthSpace) + w -= 1 + } + out.WriteRune(r) + } + args[i] = out.String() + } + } + return string(retval), args, nil handle_end_error: |