wrap bar filling under 'curWidth != 0' branch
Vladimir Bauer
2 years ago
| 234 | 234 | var fillCount int |
| 235 | 235 | curWidth := int(internal.PercentageRound(stat.Total, stat.Current, uint(width))) |
| 236 | 236 | |
| 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 | } | |
| 256 | 257 | } |
| 257 | 258 | } |
| 258 | 259 |