fix bug, when numBars > numDrawers
Vladimir Bauer
9 years ago
| 321 | 321 | ws.listen[i] = make(chan int, numBars) |
| 322 | 322 | ws.result[i] = make(chan int, numBars) |
| 323 | 323 | } |
| 324 | for i, listenCh := range ws.listen { | |
| 324 | for i := 0; i < numColumn; i++ { | |
| 325 | 325 | go func(listenCh <-chan int, resultCh chan<- int) { |
| 326 | defer close(resultCh) | |
| 326 | 327 | widths := make([]int, 0, numBars) |
| 327 | 328 | loop: |
| 328 | 329 | for { |
| 340 | 341 | for i := 0; i < numBars; i++ { |
| 341 | 342 | resultCh <- result |
| 342 | 343 | } |
| 343 | close(resultCh) | |
| 344 | }(listenCh, ws.result[i]) | |
| 344 | }(ws.listen[i], ws.result[i]) | |
| 345 | 345 | } |
| 346 | 346 | return ws |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | func drawer(ibars <-chan indexedBar, c chan<- indexedBarBuffer, prependWs, appendWs *widthSync) { | |
| 349 | func drawer(ibars <-chan indexedBar, ibbCh chan<- indexedBarBuffer, prependWs, appendWs *widthSync) { | |
| 350 | 350 | for b := range ibars { |
| 351 | 351 | buf := b.bar.bytes(b.termWidth, prependWs, appendWs) |
| 352 | 352 | buf = append(buf, '\n') |