From f1ef3089c5104ca47bae536a33a487945b82a73f Mon Sep 17 00:00:00 2001 From: Jeffrey Tolar Date: Sat, 16 Jul 2016 13:10:47 -0500 Subject: [PATCH] Move the cursor up one line XTerm interprets "cursor up N lines" as "cursor up 1 line" for all N <= 0. rxvt-unicode (and possibly others), however, treat "cursor up 0 lines" as moving 0 lines. Fixes gosuri/uiprogress#16 --- writer_posix.go | 2 +- writer_windows.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/writer_posix.go b/writer_posix.go index 9da3286..0ec2498 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[%dA", ESC, 1) // move the cursor up fmt.Fprintf(w.Out, "%c[2K\r", ESC) // clear the line } } diff --git a/writer_windows.go b/writer_windows.go index 4de3b36..695e68e 100644 --- a/writer_windows.go +++ b/writer_windows.go @@ -49,7 +49,7 @@ func (w *Writer) clearLines() { } if !ok { for i := 0; i < w.lineCount; i++ { - fmt.Fprintf(w.Out, "%c[%dA", ESC, 0) // move the cursor up + fmt.Fprintf(w.Out, "%c[%dA", ESC, 1) // move the cursor up fmt.Fprintf(w.Out, "%c[2K\r", ESC) // clear the line } return