Fix infinte loop + backwards ignore behavior

This commit is contained in:
Christian Rocha 2020-06-16 22:30:47 -04:00
parent 683473c26d
commit b72009105b
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
1 changed files with 2 additions and 2 deletions

View File

@ -147,7 +147,7 @@ func (r *renderer) flush() {
if r.linesRendered > 0 { if r.linesRendered > 0 {
// Clear the lines we painted in the last render. // Clear the lines we painted in the last render.
for i := r.linesRendered; i >= 0; i++ { for i := r.linesRendered; i > 0; i-- {
// Check and see if we should skip rendering for this line. That // Check and see if we should skip rendering for this line. That
// includes clearing the line, which we normally do before a // includes clearing the line, which we normally do before a
// render. // render.
@ -160,7 +160,7 @@ func (r *renderer) flush() {
r.linesRendered = 0 r.linesRendered = 0
for _, b := range r.buf.Bytes() { for _, b := range r.buf.Bytes() {
if _, exists := r.ignoreLines[r.linesRendered]; !exists { if _, exists := r.ignoreLines[r.linesRendered]; exists {
cursorDown(out) // skip rendering for this line. cursorDown(out) // skip rendering for this line.
r.linesRendered++ r.linesRendered++
} else if b == '\n' { } else if b == '\n' {