From c99b1eb7c0600ccee6dc99debb0645ae77c48a30 Mon Sep 17 00:00:00 2001 From: Adam Bozanich Date: Wed, 22 Mar 2017 20:01:20 -0700 Subject: [PATCH] Fix "infinite scrolling" issue. Move up a line with ansi control code instead of down a line with '\r'. --- writer_posix.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/writer_posix.go b/writer_posix.go index 9da3286..bec6a1d 100644 --- a/writer_posix.go +++ b/writer_posix.go @@ -8,7 +8,7 @@ import ( func (w *Writer) clearLines() { for i := 0; i < w.lineCount; i++ { - fmt.Fprintf(w.Out, "%c[%dA", ESC, 0) // move the cursor up - fmt.Fprintf(w.Out, "%c[2K\r", ESC) // clear the line + fmt.Fprintf(w.Out, "%c[2K", ESC) // clear the line + fmt.Fprintf(w.Out, "%c[%dA", ESC, 1) // move the cursor up } }