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

View File

@@ -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())
}