Fix showing data usage indicators

This commit is contained in:
Arturo Filastò 2018-09-12 14:03:07 +02:00
commit 2b1fb662fb
3 changed files with 21 additions and 7 deletions

View file

@ -38,7 +38,11 @@ func EscapeAwareRuneCountInString(s string) int {
}
func RightPad(str string, length int) string {
return str + strings.Repeat(" ", length-EscapeAwareRuneCountInString(str))
c := length - EscapeAwareRuneCountInString(str)
if c < 0 {
c = 0
}
return str + strings.Repeat(" ", c)
}
// WrapString wraps the given string within lim width in characters.