Skip to content

Commit

Permalink
Merge pull request #207 from MegaRedHand/fix/change-max-unknown
Browse files Browse the repository at this point in the history
fix: set length to unknown if set to -1
  • Loading branch information
schollz authored Nov 7, 2024
2 parents dcad234 + 9151851 commit da94fe0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion progressbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,11 @@ func (p *ProgressBar) ChangeMax64(newMax int64) {
p.config.useIECUnits)
}

p.lengthKnown(newMax)
if newMax == -1 {
p.lengthUnknown()
} else {
p.lengthKnown(newMax)
}
p.lock.Unlock() // so p.Add can lock

p.Add(0) // re-render
Expand Down

0 comments on commit da94fe0

Please sign in to comment.