diff --git a/screen.go b/screen.go index c906f8d310..d27cbf0d0f 100644 --- a/screen.go +++ b/screen.go @@ -27,10 +27,6 @@ func cursorDown(w io.Writer) { fmt.Fprintf(w, te.CSI+te.CursorDownSeq, 1) } -func cursorUpBy(w io.Writer, count int) { - fmt.Fprintf(w, te.CSI+te.CursorUpSeq, count) -} - func insertLine(w io.Writer, numLines int) { fmt.Fprintf(w, te.CSI+"%dL", numLines) } diff --git a/screen_test.go b/screen_test.go index 335399df1d..7bfdf2e676 100644 --- a/screen_test.go +++ b/screen_test.go @@ -46,13 +46,7 @@ func TestScreen(t *testing.T) { exercise(t, cursorUp, []byte("\x1b[1A")) }) - t.Run("upBy", func(t *testing.T) { - exercise(t, func(w io.Writer) { - cursorUpBy(w, 3) - }, []byte("\x1b[3A")) - }) - - t.Run("downBy", func(t *testing.T) { + t.Run("down", func(t *testing.T) { exercise(t, cursorDown, []byte("\x1b[1B")) }) diff --git a/standard_renderer.go b/standard_renderer.go index 1f8cb47cfd..67a0e80514 100644 --- a/standard_renderer.go +++ b/standard_renderer.go @@ -138,23 +138,17 @@ func (r *standardRenderer) flush() { // Clear any lines we painted in the last render. if r.linesRendered > 0 { - jumpedLines := 0 for i := r.linesRendered - 1; i > 0; i-- { // If the number of lines we want to render hasn't increased and // new line is the same as the old line we can skip rendering for // this line as a performance optimization. if (len(newLines) <= len(oldLines)) && (len(newLines) > i && len(oldLines) > i) && (newLines[i] == oldLines[i]) { skipLines[i] = struct{}{} - jumpedLines++ - } else { - cursorUpBy(out, jumpedLines) + } else if _, exists := r.ignoreLines[i]; !exists { clearLine(out) - - jumpedLines = 0 } - } - if jumpedLines >= 1 { - cursorUpBy(out, jumpedLines+1) + + cursorUp(out) } if _, exists := r.ignoreLines[0]; !exists {