Skip to content

Commit

Permalink
fix potential error in progress bar calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
jmorganca committed Nov 21, 2023
1 parent 6452e2e commit f2113c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion progress/bar.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ func (b *Bar) String() string {
}

// 44 is the maximum width for the stats on the right of the progress bar
suf.WriteString(strings.Repeat(" ", 44-suf.Len()-len(timing)))
pad := 44 - suf.Len() - len(timing)
if pad > 0 {
suf.WriteString(strings.Repeat(" ", pad))
}
suf.WriteString(timing)

// add 3 extra spaces: 2 boundary characters and 1 space at the end
Expand Down

0 comments on commit f2113c1

Please sign in to comment.