^[control-codes
live in libghostty-vt

Control sequences

HPB Character Position Backward

View as Markdown

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.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Nonot in the manual
VT510manual, 1st ed., 1993Nonot in the manual
xtermpatch 412, xterm-411aNoignored
libghostty-vt0f171f6Yesimplemented as CUB, where xterm ignores it (HPB-1, -2, -3)
ConEmubuild 230724, its documentationNonot in ANSI escape codes

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