bar filler: shorter for loops
Vladimir Bauer
2 years ago
| 220 | 220 | refWidth := int(internal.PercentageRound(stat.Total, stat.Refill, uint(width))) |
| 221 | 221 | curWidth -= refWidth |
| 222 | 222 | refWidth += curWidth |
| 223 | for curWidth-fillCount >= s.components[iFiller].width { | |
| 223 | for w := s.components[iFiller].width; curWidth-fillCount >= w; fillCount += w { | |
| 224 | 224 | filling = append(filling, s.components[iFiller].bytes...) |
| 225 | fillCount += s.components[iFiller].width | |
| 226 | } | |
| 227 | for refWidth-fillCount >= s.components[iRefiller].width { | |
| 225 | } | |
| 226 | for w := s.components[iRefiller].width; refWidth-fillCount >= w; fillCount += w { | |
| 228 | 227 | refilling = append(refilling, s.components[iRefiller].bytes...) |
| 229 | fillCount += s.components[iRefiller].width | |
| 230 | 228 | } |
| 231 | 229 | } else { |
| 232 | for curWidth-fillCount >= s.components[iFiller].width { | |
| 230 | for w := s.components[iFiller].width; curWidth-fillCount >= w; fillCount += w { | |
| 233 | 231 | filling = append(filling, s.components[iFiller].bytes...) |
| 234 | fillCount += s.components[iFiller].width | |
| 235 | } | |
| 236 | } | |
| 237 | ||
| 238 | for width-fillCount >= s.components[iPadding].width { | |
| 232 | } | |
| 233 | } | |
| 234 | ||
| 235 | for w := s.components[iPadding].width; width-fillCount >= w; fillCount += w { | |
| 239 | 236 | padding = append(padding, s.components[iPadding].bytes...) |
| 240 | fillCount += s.components[iPadding].width | |
| 241 | 237 | } |
| 242 | 238 | |
| 243 | 239 | if width-fillCount != 0 { |