From 6a0398d786073053d346fec3714d39ac4e9dcb85 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Wed, 1 Mar 2023 16:07:10 +0100 Subject: [PATCH] pad can be negative on small terminal Signed-off-by: Nicolas De Loof --- pkg/progress/tty.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/progress/tty.go b/pkg/progress/tty.go index 3490dd939..148826a6d 100644 --- a/pkg/progress/tty.go +++ b/pkg/progress/tty.go @@ -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) }