^[control-codes live in libghostty-vt

Control sequences

HPB Character Position Backward

Move the cursor left n columns.

CSI Pn j
Defaults
Pn = 1
ECMA-48
§8.3.58 HPB – Character Position Backward, p. 45

Move the cursor Pn columns to the left, on the line it is on. A 0 is taken as 1.

ECMA-48 defines it, as the counterpart of HPR, 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 … j 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 HPB as CUB: the same final-byte handler serves both, so it moves the cursor left as ECMA-48 describes. That makes every case below a known difference.

Validation

HPB-1: Ignored, with the default

ABCD
\e[j      # ECMA-48: one column left
X
|ABCDX|

HPB-2: Ignored, with a count

ABCD
\e[3j     # ECMA-48: three columns left
X
|ABCDX|

HPB-3: Ignored, with a count past the first column

ABC
\e[99j    # ECMA-48: as far left as the first column
X
|ABCX_|