diff options
author | Yang Zhang <yang_zhang@iapcm.ac.cn> | 2018-12-28 22:50:15 +0800 |
---|---|---|
committer | Yang Zhang <yang_zhang@iapcm.ac.cn> | 2018-12-30 08:38:31 +0800 |
commit | 52419165350a2b36706a6fb67acda862d80d6730 (patch) | |
tree | 51b4c111f6501dc875b3ca4c01834cdd8d1334fe /util | |
parent | d823bc572801c8f324584e6fd85c57bc83d551db (diff) | |
download | git-bug-52419165350a2b36706a6fb67acda862d80d6730.tar.gz |
Use ASCII ellipsis to workaround inaccurate width of unicode ellipsis
Diffstat (limited to 'util')
-rw-r--r-- | util/text/left_padded.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util/text/left_padded.go b/util/text/left_padded.go index 3b8e13c6..24bd4d09 100644 --- a/util/text/left_padded.go +++ b/util/text/left_padded.go @@ -10,12 +10,12 @@ import ( // LeftPadMaxLine pads a string on the left by a specified amount and pads the // string on the right to fill the maxLength func LeftPadMaxLine(text string, length, leftPad int) string { - rightPart := text + var rightPart string = text scrWidth := runewidth.StringWidth(text) // truncate and ellipse if needed if scrWidth+leftPad > length { - rightPart = runewidth.Truncate(text, length-leftPad, "…") + rightPart = runewidth.Truncate(text, length-leftPad, "...") } else if scrWidth+leftPad < length { rightPart = runewidth.FillRight(text, length-leftPad) } |