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.
Support
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | No | not in the manual |
| VT510 | manual, 1st ed., 1993 | No | not in the manual |
| xterm | patch 412, xterm-411a | No | ignored |
| libghostty-vt | 0f171f6 | Yes | implemented as CUB, where xterm ignores it (HPB-1, -2, -3) |
| ConEmu | build 230724, its documentation | No | not 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_|