^[control-codes live in libghostty-vt

Control sequences

HPA Character Position Absolute

Move the cursor to column n of the line it is on.

CSI Pn `
Defaults
Pn = 1
ECMA-48
§8.3.57 HPA – Character Position Absolute, p. 45
VT510
HPA—Horizontal Position Absolute

Move the cursor to column Pn of the line it is on, counting from 1. The line does not change. A 0 is taken as 1. The VT510 manual says that an attempt to move past the last position on the line stops at the last position.

This is CHA under another final byte. ECMA-48 defines HPA in terms of the data component and CHA in terms of the presentation component, but a terminal has no separate data component, and for such a device ECMA-48 reads the one as the other (§6, p. 14). libghostty-vt handles the two with the same code.

The VT510 manual’s one-line summary of HPA, at the top of its page, is a copying error: it describes asking about free memory for programmable keys. The description beneath it is the right one.

Validation

HPA-1: To a column

\e[2;5H
\e[2`
X
|_____|
|_X___|

HPA-2: To the first column by default

\e[1;4H
\e[`
X
|X____|

HPA-3: Stops at the last column

\e[2;1H
\e[99`
X
|_____|
|____X|
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.