summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Czapliński <czapkofan@gmail.com>2018-03-10 21:36:31 +0100
committerMateusz Czapliński <czapkofan@gmail.com>2018-03-10 21:36:31 +0100
commit1cc58d089424d1025f7d31f6c5b0137cc1ff830e (patch)
tree448661f4cf66ea991c73501d9a367f647b56bf04
parent32c7b859eb8e51585bf7994af555b32fd33fafb2 (diff)
clear lines
-rw-r--r--up.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/up.go b/up.go
index e073658..c4de9e0 100644
--- a/up.go
+++ b/up.go
@@ -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