mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 10:41:58 +02:00
...
This commit is contained in:
@@ -463,7 +463,7 @@ func render_duration(val time.Duration) (ans string) {
|
|||||||
ans = zero_pad(hr) + `:` + zero_pad(min) + `:` + zero_pad(secs)
|
ans = zero_pad(hr) + `:` + zero_pad(min) + `:` + zero_pad(secs)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ans = "<1s"
|
ans = "<1 sec"
|
||||||
}
|
}
|
||||||
if w := wcswidth.Stringwidth(ans); w < 8 {
|
if w := wcswidth.Stringwidth(ans); w < 8 {
|
||||||
ans = strings.Repeat(" ", 8-w) + ans
|
ans = strings.Repeat(" ", 8-w) + ans
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ func TestRenderDuration(t *testing.T) {
|
|||||||
t.Fatalf("Failed for %f (%s): %s", i, d, diff)
|
t.Fatalf("Failed for %f (%s): %s", i, d, diff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
q(0.1, " <1s")
|
q(0.1, " <1 sec")
|
||||||
q(1, `00:00:01`)
|
q(1, `00:00:01`)
|
||||||
q(1.1234567, `00:00:01`)
|
q(1.1234567, `00:00:01`)
|
||||||
q(60.1234567, `00:01:00`)
|
q(60.1234567, `00:01:00`)
|
||||||
|
|||||||
Reference in New Issue
Block a user