Codebase list golang-github-vbauerster-mpb / bccf345
refactoring tip assigment Vladimir Bauer 4 years ago
1 changed file(s) with 7 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
169169
170170 var filling [][]byte
171171 var padding [][]byte
172 var tip *component
173172 var refWidth int
174173 curWidth := int(internal.PercentageRound(stat.Total, stat.Current, width))
175174 filled := curWidth
176175
177 if stat.Current == stat.Total {
178 if s.tip.onCompleteIndex >= uint(len(s.tip.frames)) {
179 s.tip.onCompleteIndex = 0
180 }
181 tip = s.tip.frames[s.tip.onCompleteIndex]
182 } else {
183 tip = s.tip.frames[s.tip.count%uint(len(s.tip.frames))]
184 }
176 tip := s.tip.frames[s.tip.count%uint(len(s.tip.frames))]
185177
186178 if s.tip.inclusive {
187179 if curWidth > 0 {
180 if stat.Current == stat.Total {
181 if s.tip.onCompleteIndex >= uint(len(s.tip.frames)) {
182 s.tip.onCompleteIndex = 0
183 }
184 tip = s.tip.frames[s.tip.onCompleteIndex]
185 }
188186 filling = append(filling, tip.bytes)
189187 curWidth -= tip.width
190188 s.tip.count++