diff --git a/bar.go b/bar.go index 848df89..34af054 100644 --- a/bar.go +++ b/bar.go @@ -189,7 +189,6 @@ } if s.current >= s.total { s.current = s.total - s.completed = true s.triggerCompletion(b) } else { s.triggerComplete = true @@ -217,7 +216,6 @@ } if complete { s.current = s.total - s.completed = true s.triggerCompletion(b) } }: @@ -235,7 +233,6 @@ s.current = current if s.triggerComplete && s.current >= s.total { s.current = s.total - s.completed = true s.triggerCompletion(b) } }: @@ -257,7 +254,6 @@ s.current = current if s.triggerComplete && s.current >= s.total { s.current = s.total - s.completed = true s.triggerCompletion(b) } result <- &wg @@ -285,7 +281,6 @@ s.current += n if s.triggerComplete && s.current >= s.total { s.current = s.total - s.completed = true s.triggerCompletion(b) } }: @@ -314,7 +309,6 @@ s.current += n if s.triggerComplete && s.current >= s.total { s.current = s.total - s.completed = true s.triggerCompletion(b) } result <- &wg @@ -558,7 +552,8 @@ return table } -func (s bState) triggerCompletion(b *Bar) { +func (s *bState) triggerCompletion(b *Bar) { + s.completed = s.current == s.total if s.autoRefresh { // Technically this call isn't required, but if refresh rate is set to // one hour for example and bar completes within a few minutes p.Wait()