Skip to content

Commit

Permalink
Merge pull request #116 from T1MOXA/fix/humanized-max
Browse files Browse the repository at this point in the history
ChangeMax64 did not work with OptionShowBytes
  • Loading branch information
schollz committed Dec 20, 2021
2 parents 236c1d2 + 18a2de6 commit eaf664f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions progressbar.go
Expand Up @@ -548,6 +548,11 @@ func (p *ProgressBar) ChangeMax(newMax int) {
// to avoid casting
func (p *ProgressBar) ChangeMax64(newMax int64) {
p.config.max = newMax

if p.config.showBytes {
p.config.maxHumanized, p.config.maxHumanizedSuffix = humanizeBytes(float64(p.config.max))
}

p.Add(0) // re-render
}

Expand Down

0 comments on commit eaf664f

Please sign in to comment.