^[control-codes
live in libghostty-vt

Control sequences

HPA Character Position Absolute

View as Markdown

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.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Nonot in the manual
VT510manual, 1st ed., 1993YesHPA
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yeshandled by the same code as CHA
kitty0.49.1, run in a VMYespasses the 3 cases that show it working
foot1.28.0, run in a VMYespasses the 3 cases that show it working
pyte0.8.2, run as a libraryNofails the 3 cases that show it working
xterm.js headless6.0.0, run as a libraryYespasses the 3 cases that show it working
alacritty_terminal0.26.0, run as a libraryYespasses the 3 cases that show it working
ConEmubuild 230724, its documentationNonot in ANSI escape codes
rxvt-unicode9.31, run in a VMYespasses the 3 cases that show it working
VTE0.84.1, run as a libraryYespasses the 3 cases that show it working

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.