Add cursor positioning functions to viewport renderder

This commit is contained in:
Christian Rocha 2020-06-16 16:10:34 -04:00
parent 3321ac12a9
commit d9c03fc0b0
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
2 changed files with 10 additions and 2 deletions

View File

@ -95,3 +95,11 @@ func clearLine(w io.Writer) {
func insertLine(w io.Writer, numLines int) {
fmt.Fprintf(w, te.CSI+"%dL", numLines)
}
func saveCursorPosition(w io.Writer) {
fmt.Fprint(w, te.CSI+"s")
}
func restoreCursorPosition(w io.Writer) {
fmt.Fprint(w, te.CSI+"u")
}

View File

@ -21,8 +21,8 @@ type Model struct {
// It's used in high performance rendering.
Y int
// UseInternalRenderer specifies whether or not to use the pager's internal,
// high performance renderer to paint the screen.
// UseInternalRenderer specifies whether or not to use the pager's
// internal, high performance renderer to paint the screen.
UseInternalRenderer bool
lines []string