^[control-codes live in libghostty-vt

Control sequences

CTC Cursor Tabulation Control

Set or clear tab stops: at the cursor, or all of them.

CSI Pm W
Defaults
Ps = 0
ECMA-48
§8.3.17 CTC – Cursor Tabulation Control, p. 36

Set or clear tab stops, chosen by each parameter:

PsECMA-48libghostty-vt
0, or left outset a tab stop at the cursor’s columnthe same, as HTS does
2clear the tab stop at the cursor’s columnthe same, as CSI 0 g (TBC) does
5clear every tab stopthe same, as CSI 3 g does
1, 3, 6set or clear line tabulation stopsignored
4clear the tab stops in the cursor’s lineignored

Line tabulation stops are for vertical tabs, which terminals treat as line feeds, so terminals have no use for them. Neither DEC STD 070 nor the VT510 manual defines CTC.

xterm does not implement CTC at all: its parse table sends CSI … W straight back to the ground state (VTPrsTbl.c), so every value is ignored. The cases follow xterm, as the sources page explains, and expect the tab stops to be left alone. libghostty-vt does implement the character tab stop values 0, 2 and 5, which makes CTC-1 to CTC-3 known differences.

CSI ? 5 W is a different function, DEC’s DECST8C: it puts the tab stops back to one every eight columns, starting at column 9, the way they start out. xterm runs it only when emulating a VT510 or later (CASE_DECST8C checks vtXX_level >= 5), and a default xterm is a VT420, so there it is ignored too. libghostty-vt always runs it, which makes CTC-4 a known difference. Many cases on this site begin with CSI ? 5 W before touching any tab stop; since the tab stops start out every eight columns anyway, those cases come out the same whether it runs or not.

Validation

CTC-1: Setting a tab stop is ignored

\e[3g     # clear every tab stop
\e[1;4H
\e[W      # would set one at column 4
\r
A\tX      # no tab stop, so the tab goes to the last column
|A__________X|

CTC-2: Clearing the tab stop at the cursor is ignored

\e[?5W    # tab stops every 8 columns
\e[1;9H
\e[2W     # would clear the one at column 9
\r
\tX       # the tab stop at column 9 is still there
|________X___|

CTC-3: Clearing every tab stop is ignored

\e[?5W    # tab stops every 8 columns
\e[5W     # would clear them all
\tX
|________X___|

CTC-4: DECST8C is ignored by a VT420

\e[3g     # clear every tab stop
\e[?5W    # a VT510 would restore them; a VT420 ignores it
\tX       # no tab stop, so the tab goes to the last column
|___________X|
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.