From ebbab2908ce8d5fcdf14b3e5723c9b9d6738b4a9 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Sat, 20 Jun 2020 18:26:25 -0400 Subject: [PATCH] Put cursor back where we found it after scrolling --- renderer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/renderer.go b/renderer.go index 9deab8f..6c472dc 100644 --- a/renderer.go +++ b/renderer.go @@ -215,6 +215,9 @@ func (r *renderer) insertTop(lines []string, topBoundary, bottomBoundary int) { _, _ = io.WriteString(b, strings.Join(lines, "\r\n")) changeScrollingRegion(b, 0, r.height) + // Move cursor back to where the main rendering routine expects it to be + moveCursor(b, r.linesRendered, 0) + r.out.Write(b.Bytes()) } @@ -238,6 +241,9 @@ func (r *renderer) insertBottom(lines []string, topBoundary, bottomBoundary int) _, _ = io.WriteString(b, "\r\n"+strings.Join(lines, "\r\n")) changeScrollingRegion(b, 0, r.height) + // Move cursor back to where the main rendering routine expects it to be + moveCursor(b, r.linesRendered, 0) + r.out.Write(b.Bytes()) }