do append '\n' in drawer
Vladimir Bauer
9 years ago
| 28 | 28 | |
| 29 | 29 | indexedBarBuffer struct { |
| 30 | 30 | index int |
| 31 | buff []byte | |
| 31 | buf []byte | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | indexedBar struct { |
| 242 | 242 | |
| 243 | 243 | m := make(map[int][]byte, len(bars)) |
| 244 | 244 | for r := range c { |
| 245 | m[r.index] = r.buff | |
| 245 | m[r.index] = r.buf | |
| 246 | 246 | } |
| 247 | 247 | for i := 0; i < len(bars); i++ { |
| 248 | m[i] = append(m[i], '\n') | |
| 249 | 248 | cw.Write(m[i]) |
| 250 | 249 | } |
| 251 | 250 | |
| 267 | 266 | |
| 268 | 267 | func drawer(ibars <-chan indexedBar, c chan<- indexedBarBuffer) { |
| 269 | 268 | for b := range ibars { |
| 270 | c <- indexedBarBuffer{b.index, b.bar.bytes(b.width)} | |
| 269 | buf := b.bar.bytes(b.width) | |
| 270 | buf = append(buf, '\n') | |
| 271 | c <- indexedBarBuffer{b.index, buf} | |
| 271 | 272 | } |
| 272 | 273 | } |
| 273 | 274 | |