Codebase list golang-github-vbauerster-mpb / 6513a42
No need to check bar's complete rune Vladimir Bauer 8 years ago
1 changed file(s) with 1 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
303303 close(ch)
304304 }()
305305 s.draw(tw, prependWs, appendWs)
306 ch <- &writeBuf{s.toBytes(), s.isFull()}
306 ch <- &writeBuf{s.toBytes(), s.completed}
307307 }:
308308 case <-b.done:
309309 s := b.cacheState
335335 s.blockStartTime = next
336336 }
337337
338 func (s *state) isFull() bool {
339 if !s.completed {
340 return false
341 }
342 bar := s.bufB.Bytes()
343 var r rune
344 var n int
345 for i := 0; len(bar) > 0; i++ {
346 r, n = utf8.DecodeLastRune(bar)
347 bar = bar[:len(bar)-n]
348 if i == 1 {
349 break
350 }
351 }
352 return r == s.format[rFill]
353 }
354
355338 func (s *state) draw(termWidth int, prependWs, appendWs *widthSync) {
356339 if termWidth <= 0 {
357340 termWidth = 2