Codebase list golang-github-vbauerster-mpb / dad3fdd
fix bug, when numBars > numDrawers Vladimir Bauer 9 years ago
1 changed file(s) with 4 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
321321 ws.listen[i] = make(chan int, numBars)
322322 ws.result[i] = make(chan int, numBars)
323323 }
324 for i, listenCh := range ws.listen {
324 for i := 0; i < numColumn; i++ {
325325 go func(listenCh <-chan int, resultCh chan<- int) {
326 defer close(resultCh)
326327 widths := make([]int, 0, numBars)
327328 loop:
328329 for {
340341 for i := 0; i < numBars; i++ {
341342 resultCh <- result
342343 }
343 close(resultCh)
344 }(listenCh, ws.result[i])
344 }(ws.listen[i], ws.result[i])
345345 }
346346 return ws
347347 }
348348
349 func drawer(ibars <-chan indexedBar, c chan<- indexedBarBuffer, prependWs, appendWs *widthSync) {
349 func drawer(ibars <-chan indexedBar, ibbCh chan<- indexedBarBuffer, prependWs, appendWs *widthSync) {
350350 for b := range ibars {
351351 buf := b.bar.bytes(b.termWidth, prependWs, appendWs)
352352 buf = append(buf, '\n')