Skip to content
Myr

Use DECSC/DECRC instead of CSI s/u

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Honored by more terminals, e.g. fixes cursor restoration with --height --no-clear inside nvim terminal.

authored by Junegunn Choi · committed by Junegunn Choi · parent 1462f13 · Browse files · 1 file+2 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−5 removed

  • other:+2 added−5 removed

1 file+2 added−5 removed

modified:src/tui/light.go+2 added-5 removed
230 unmodified lines
231 r.csi(fmt.Sprintf("%dA", r.MaxY()-1))232 r.csi("G")233 r.csi("K")234 if !r.clearOnExit && !r.fullscreen {235 r.csi("s")235 r.stderr("\x1b7") // DECSC: save cursor position236 }237 if !r.fullscreen && r.mouse {238 r.yoffset, _ = r.findOffset()239 }
9 unmodified lines
249 r.csi("G")250}251252func (r *LightRenderer) move(y int, x int) {253 // w.csi("u")253 if r.y < y {254 r.csi(fmt.Sprintf("%dB", y-r.y))255 } else if r.y > y {256 r.csi(fmt.Sprintf("%dA", r.y-y))
763 unmodified lines
1020func (r *LightRenderer) Clear() {1021 if r.fullscreen {1022 r.csi("H")1023 }1025 // r.csi("u")1024 r.origin()1025 r.csi("J")1026 r.flush()1027}
14 unmodified lines
1042 r.updateTerminalSize()1043}10441045func (r *LightRenderer) Close() {1048 // r.csi("u")1046 if r.clearOnExit {1047 if r.fullscreen {1048 r.rmcup()1049 } else {
3 unmodified lines
1053 }1054 r.csi("J")1055 }1056 } else if !r.fullscreen {1060 r.csi("u")1057 r.stderr("\x1b8") // DECRC: restore cursor position1058 }1059 if !r.showCursor {1060 r.csi("?25h")1061 }
502 unmodified lines