^[control-codes live in libghostty-vt

C0 control characters

HT Horizontal Tab

Move the cursor right to the next tab stop.

HT
ECMA-48
§8.3.60 HT – Character Tabulation, p. 45
DEC STD 070
§5.4.5 Horizontal Tab, p. 5-67
VT510
4.2 Control Characters

Move the cursor right to the next tab stop. If there is no tab stop between the cursor and the right margin, the cursor goes to the right margin and stops there: a tab never wraps onto the next line.

The cells passed over are left as they are, not filled with spaces. A terminal that copies its screen as text usually turns the run of empty cells back into spaces, or into the tab itself, but on the screen there is nothing there.

Tab stops start out every eight columns (columns 9, 17, 25 and so on) in libghostty-vt and most other terminals. CSI ? 5 W restores those, HTS sets one at the cursor, and TBC clears them. CHT moves forward several tab stops at once and CBT moves back.

Validation

HT-1: To the next tab stop

\e[?5W    # reset tab stops
A\tB
|A_______B___________|
cursor 1,10

HT-2: From exactly on a tab stop

\e[?5W    # reset tab stops
\e[1;9H   # column 9 is a tab stop
\t
X
|________________X___|

HT-3: Stops at the right margin

\e[?5W    # reset tab stops
\t\t\t\t
X
|___________________X|
|____________________|
cursor 1,20
pending-wrap yes