From da9a1fe2f4e6e2e7a9489945311afdf01e834781 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 18 Jun 2020 14:35:04 -0400 Subject: [PATCH] Correct scroll area top positioning --- renderer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/renderer.go b/renderer.go index 4fc872e..04174db 100644 --- a/renderer.go +++ b/renderer.go @@ -204,13 +204,14 @@ func (r *renderer) insertTop(lines []string, topBoundary, bottomBoundary int) { r.mtx.Lock() defer r.mtx.Unlock() + topBoundary += 1 b := new(bytes.Buffer) saveCursorPosition(b) changeScrollingRegion(b, topBoundary, bottomBoundary) moveCursor(b, topBoundary, 0) insertLine(b, len(lines)) - _, _ = io.WriteString(b, "\r\n"+strings.Join(lines, "\r\n")) + _, _ = io.WriteString(b, strings.Join(lines, "\r\n")) changeScrollingRegion(b, 0, r.height) restoreCursorPosition(b) @@ -230,6 +231,7 @@ func (r *renderer) insertBottom(lines []string, topBoundary, bottomBoundary int) r.mtx.Lock() defer r.mtx.Unlock() + topBoundary += 1 b := new(bytes.Buffer) saveCursorPosition(b)