Codebase list golang-github-vbauerster-mpb / 3fa6d15
wrap bar filling under 'curWidth != 0' branch Vladimir Bauer 2 years ago
1 changed file(s) with 20 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
234234 var fillCount int
235235 curWidth := int(internal.PercentageRound(stat.Total, stat.Current, uint(width)))
236236
237 if curWidth != 0 && (!stat.Completed || s.tipOnComplete) {
238 tip = s.tip.frames[s.tip.count%uint(len(s.tip.frames))]
239 s.tip.count++
240 fillCount += tip.width
241 }
242
243 if stat.Refill != 0 {
244 refWidth := int(internal.PercentageRound(stat.Total, stat.Refill, uint(width)))
245 curWidth -= refWidth
246 refWidth += curWidth
247 for w := s.components[iFiller].width; curWidth-fillCount >= w; fillCount += w {
248 filling = append(filling, s.components[iFiller].bytes...)
249 }
250 for w := s.components[iRefiller].width; refWidth-fillCount >= w; fillCount += w {
251 refilling = append(refilling, s.components[iRefiller].bytes...)
252 }
253 } else {
254 for w := s.components[iFiller].width; curWidth-fillCount >= w; fillCount += w {
255 filling = append(filling, s.components[iFiller].bytes...)
237 if curWidth != 0 {
238 if !stat.Completed || s.tipOnComplete {
239 tip = s.tip.frames[s.tip.count%uint(len(s.tip.frames))]
240 s.tip.count++
241 fillCount += tip.width
242 }
243 if stat.Refill != 0 {
244 refWidth := int(internal.PercentageRound(stat.Total, stat.Refill, uint(width)))
245 curWidth -= refWidth
246 refWidth += curWidth
247 for w := s.components[iFiller].width; curWidth-fillCount >= w; fillCount += w {
248 filling = append(filling, s.components[iFiller].bytes...)
249 }
250 for w := s.components[iRefiller].width; refWidth-fillCount >= w; fillCount += w {
251 refilling = append(refilling, s.components[iRefiller].bytes...)
252 }
253 } else {
254 for w := s.components[iFiller].width; curWidth-fillCount >= w; fillCount += w {
255 filling = append(filling, s.components[iFiller].bytes...)
256 }
256257 }
257258 }
258259