^[control-codes
live in libghostty-vt

Control sequences

VPB Line Position Backward

View as Markdown

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.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Nonot in the manual
VT510manual, 1st ed., 1993Nonot in the manual
xtermpatch 412, xterm-411aNoits parse table sends CSI … k to ground
libghostty-vt0f171f6Yesas CUU; VPB-1 to VPB-3: moves the cursor, where xterm ignores it
ConEmubuild 230724, its documentationNonot in ConEmu’s list; ANSI escape codes

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__|
|_____|
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.