Remove cursor save/restore as it was wrecking things

Also, um, we didn't need it.
This commit is contained in:
Christian Rocha 2020-06-18 20:10:20 -04:00
parent d4d553c447
commit 00f7f5be93
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
2 changed files with 0 additions and 12 deletions

View File

@ -209,13 +209,11 @@ func (r *renderer) insertTop(lines []string, topBoundary, bottomBoundary int) {
topBoundary += 1 topBoundary += 1
b := new(bytes.Buffer) b := new(bytes.Buffer)
saveCursorPosition(b)
changeScrollingRegion(b, topBoundary, bottomBoundary) changeScrollingRegion(b, topBoundary, bottomBoundary)
moveCursor(b, topBoundary, 0) moveCursor(b, topBoundary, 0)
insertLine(b, len(lines)) insertLine(b, len(lines))
_, _ = 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)
restoreCursorPosition(b)
r.out.Write(b.Bytes()) r.out.Write(b.Bytes())
} }
@ -236,12 +234,10 @@ func (r *renderer) insertBottom(lines []string, topBoundary, bottomBoundary int)
topBoundary += 1 topBoundary += 1
b := new(bytes.Buffer) b := new(bytes.Buffer)
saveCursorPosition(b)
changeScrollingRegion(b, topBoundary, bottomBoundary) changeScrollingRegion(b, topBoundary, bottomBoundary)
moveCursor(b, bottomBoundary, 0) moveCursor(b, bottomBoundary, 0)
_, _ = 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)
restoreCursorPosition(b)
r.out.Write(b.Bytes()) r.out.Write(b.Bytes())
} }

View File

@ -27,14 +27,6 @@ func moveCursor(w io.Writer, row, col int) {
fmt.Fprintf(w, te.CSI+te.CursorPositionSeq, row, col) fmt.Fprintf(w, te.CSI+te.CursorPositionSeq, row, col)
} }
func saveCursorPosition(w io.Writer) {
fmt.Fprint(w, te.CSI+te.SaveCursorPositionSeq)
}
func restoreCursorPosition(w io.Writer) {
fmt.Fprint(w, te.CSI+te.RestoreCursorPositionSeq)
}
func changeScrollingRegion(w io.Writer, top, bottom int) { func changeScrollingRegion(w io.Writer, top, bottom int) {
fmt.Fprintf(w, te.CSI+te.ChangeScrollingRegionSeq, top, bottom) fmt.Fprintf(w, te.CSI+te.ChangeScrollingRegionSeq, top, bottom)
} }