pad can be negative on small terminal

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2023-03-01 16:07:10 +01:00 committed by Nicolas De loof
parent 4434cea535
commit 6a0398d786
1 changed files with 5 additions and 1 deletions

View File

@ -281,7 +281,11 @@ func numDone(events map[string]Event) int {
func align(l, r string, w int) string {
ll := lenAnsi(l)
lr := lenAnsi(r)
pad := strings.Repeat(" ", w-ll-lr)
pad := ""
count := w - ll - lr
if count > 0 {
pad = strings.Repeat(" ", count)
}
return fmt.Sprintf("%s%s%s\n", l, pad, r)
}