Put cursor back where we found it after scrolling

This commit is contained in:
Christian Rocha 2020-06-20 18:26:25 -04:00
parent eff99294e1
commit ebbab2908c
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
1 changed files with 6 additions and 0 deletions

View File

@ -215,6 +215,9 @@ func (r *renderer) insertTop(lines []string, topBoundary, bottomBoundary int) {
_, _ = io.WriteString(b, strings.Join(lines, "\r\n")) _, _ = io.WriteString(b, strings.Join(lines, "\r\n"))
changeScrollingRegion(b, 0, r.height) 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()) 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")) _, _ = io.WriteString(b, "\r\n"+strings.Join(lines, "\r\n"))
changeScrollingRegion(b, 0, r.height) 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()) r.out.Write(b.Bytes())
} }