diff options
author | Mateusz Czapliński <czapkofan@gmail.com> | 2018-03-10 21:36:31 +0100 |
---|---|---|
committer | Mateusz Czapliński <czapkofan@gmail.com> | 2018-03-10 21:36:31 +0100 |
commit | 1cc58d089424d1025f7d31f6c5b0137cc1ff830e (patch) | |
tree | 448661f4cf66ea991c73501d9a367f647b56bf04 | |
parent | 32c7b859eb8e51585bf7994af555b32fd33fafb2 (diff) |
clear lines
-rw-r--r-- | up.go | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -148,7 +148,7 @@ func (b *Buf) Draw(y0 int) { buf = buf[sz:] switch ch { case '\n': - // TODO: clear to the end of screen line + b.endline(x, y, w) x, y = 0, y+1 continue case '\t': @@ -169,12 +169,21 @@ func (b *Buf) Draw(y0 int) { x, y = 0, y+1 } } + for ; y < h; y++ { + b.endline(0, y, w) + } } func (b *Buf) putch(x, y int, ch rune) { termbox.SetCell(x, y, ch, termbox.ColorDefault, termbox.ColorDefault) } +func (b *Buf) endline(x, y, screenw int) { + for ; x < screenw; x++ { + b.putch(x, y, ' ') + } +} + func (b *Buf) NewReader() io.Reader { // TODO: return EOF if input is fully buffered? i := 0 |