summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Czapliński <czapkofan@gmail.com>2018-03-04 22:32:24 +0100
committerMateusz Czapliński <czapkofan@gmail.com>2018-03-04 22:32:24 +0100
commit37ae8a31e37275a04b0f464d72a53b6a5e29dd98 (patch)
tree51618e827c699781bb3a7889ab9b27b278aa6792
parent758ce83e968460e89dc5179b27edc3c913ef10a3 (diff)
fix newline handling
-rw-r--r--up.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/up.go b/up.go
index 3519d86..8083ccd 100644
--- a/up.go
+++ b/up.go
@@ -130,13 +130,13 @@ func (b *Buf) Draw(y0 int) {
x, y := 0, y0
for len(buf) > 0 && y < h {
ch, sz := utf8.DecodeRune(buf)
+ buf = buf[sz:]
if ch == '\n' {
// TODO: clear to the end of screen line
x, y = 0, y+1
continue
}
termbox.SetCell(x, y, ch, termbox.ColorDefault, termbox.ColorDefault)
- buf = buf[sz:]
x++
if x > w {
x, y = 0, y+1