VPB Line Position Backward
Move the cursor up n lines, keeping its column.
CSI Pn k
- Defaults
- Pn = 1
- ECMA-48
- §8.3.159 VPB – Line Position Backward, p. 74
Move the cursor up Pn lines, keeping its column. A 0 is taken as 1.
ECMA-48 defines it, as the counterpart of VPR, for the data component, which a terminal does not have apart from its screen (§6, p. 14). Neither the VT510 manual nor xterm’s documentation lists it, and xterm ignores it: its parse table sends CSI … k straight back to the ground state (VTPrsTbl.c). The cases follow xterm, as the sources page explains, and expect the cursor not to move.
libghostty-vt implements VPB as CUU: the same final-byte handler serves both, so it moves the cursor up, stopping at the top line, or at the top margin when it starts inside the scrolling region, and never scrolling. That makes every case below a known difference.
Validation
VPB-1: Ignored, with the default
\e[3;2H
\e[k # ECMA-48: one line up
X
|_____|
|_____|
|_X___|
VPB-2: Ignored, with a count
\e[3;4H
\e[2k # ECMA-48: two lines up
X
|_____|
|_____|
|___X_|
VPB-3: Ignored, with a count past the first line
\e[2;3H
A
\e[2;3H
\e[99k # ECMA-48: as far up as the first line
X
|_____|
|__X__|
|_____|