^[control-codes
live in libghostty-vt

C0 control characters

HT Horizontal Tab

View as Markdown

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
VT220
§4.2 Control Characters
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.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Yes§4.2 Control Characters
VT510manual, 1st ed., 1993YesTable 4–1
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yes
kitty0.49.1, run in a VMPartlyfails HT-3 of the 3 cases that show it working
foot1.28.0, run in a VMYespasses the 2 cases that show it working
pyte0.8.2, run as a libraryYespasses 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
rxvt-unicode9.31, run in a VMYespasses the 2 cases that show it working
VTE0.84.1, run as a libraryYespasses the 3 cases that show it working

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