mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-10 13:59:13 +00:00
Ensure shortduration is no more than 8 chars
This commit is contained in:
parent
b60d15fe75
commit
5881041fcd
1 changed files with 3 additions and 1 deletions
|
|
@ -133,7 +133,7 @@ func zero_pad(x string) string {
|
|||
return x
|
||||
}
|
||||
|
||||
// Render the duration in exactly 8 chars
|
||||
// Render the duration in exactly 8 visual chars
|
||||
func ShortDuration(val time.Duration) (ans string) {
|
||||
if val >= time.Second {
|
||||
if val > Day {
|
||||
|
|
@ -160,6 +160,8 @@ func ShortDuration(val time.Duration) (ans string) {
|
|||
}
|
||||
if w := wcswidth.Stringwidth(ans); w < 8 {
|
||||
ans = strings.Repeat(" ", 8-w) + ans
|
||||
} else if w > 8 {
|
||||
ans = wcswidth.TruncateToVisualLength(ans, 8)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue