Upstream schollz/progressbar state of the touched files before e3d2ea3ccc
This commit is contained in:
1 parent
cf25c2235d
commit
ab40861d8a
2 files changed
+3
-32
No files matched your search
+3
-4
@@ -741,10 +741,6 @@ func (p *ProgressBar) Add64(num int64) error {
|
||||
return errors.New("max must be greater than 0")
|
||||
}
|
||||
|
||||
if !p.config.ignoreLength && p.state.currentNum+num > p.config.max {
|
||||
return errors.New("current number exceeds max")
|
||||
}
|
||||
|
||||
if p.state.currentNum < p.config.max {
|
||||
if p.config.ignoreLength {
|
||||
p.state.currentNum = (p.state.currentNum + num) % p.config.max
|
||||
@@ -778,6 +774,9 @@ func (p *ProgressBar) Add64(num int64) error {
|
||||
updateBar := p.state.currentPercent != p.state.lastPercent && p.state.currentPercent > 0
|
||||
|
||||
p.state.lastPercent = p.state.currentPercent
|
||||
if p.state.currentNum > p.config.max {
|
||||
return errors.New("current number exceeds max")
|
||||
}
|
||||
|
||||
// always update if show bytes/second or its/second
|
||||
if updateBar || p.config.showIterationsPerSecond || p.config.showIterationsCount {
|
||||
|
||||
Reference in new issue
Block a user