diff --git a/bar.go b/bar.go index ed53c2f..2ccd82a 100644 --- a/bar.go +++ b/bar.go @@ -195,10 +195,10 @@ // SetTotal sets total to an arbitrary value. It's effective only for bar // which was constructed with `total <= 0`. Setting total to negative value -// is equivalent to `(*Bar).SetTotal((*Bar).Current(), bool)` but faster. If -// triggerCompletion is true, total value is set to current and complete -// event is triggered right away. -func (b *Bar) SetTotal(total int64, triggerCompletion bool) { +// is equivalent to `(*Bar).SetTotal((*Bar).Current(), bool)` but faster. +// If `complete` is true complete event is triggered right away. +// Calling `(*Bar).EnableTriggerComplete` makes this one no operational. +func (b *Bar) SetTotal(total int64, complete bool) { select { case b.operateState <- func(s *bState) { if s.triggerComplete { @@ -209,7 +209,7 @@ } else { s.total = total } - if triggerCompletion { + if complete { s.current = s.total s.completed = true b.triggerCompletion(s)