^[control-codes live in libghostty-vt

Control sequences

TBC Tabulation Clear

Clear the tab stop at the cursor, or every tab stop.

CSI Ps g
Defaults
Ps = 0
ECMA-48
§8.3.154 TBC – Tabulation Clear, p. 73
DEC STD 070
§5.4.5 Tabulation Clear, p. 5-66
VT510
TBC—Tab Clear

Clear horizontal tab stops, chosen by Ps:

PsClears
0, or left outthe tab stop at the cursor’s column, if there is one
3every tab stop

The cursor does not move, and nothing on the screen changes; only where the next HT or CHT stops. Clearing a column that has no tab stop does nothing.

ECMA-48 defines four more values, for line tabulation stops and for clearing only the stops in the active line, but DEC STD 070 and the VT510 manual both define only 0 and 3, and the VT510 manual says there are “only two values”. Other values are ignored.

Tab stops are set again one at a time with HTS, or all reset to every eight columns with CSI ? 5 W.

Validation

TBC-1: Clear the stop at the cursor

\e[?5W    # reset tab stops
\e[1;9H   # the tab stop at column 9
\e[0g
\e[1;1H
\tX       # skips column 9
|________________X___|

TBC-2: The parameter left out

\e[?5W    # reset tab stops
\e[1;9H   # the tab stop at column 9
\e[g
\e[1;1H
\tX       # skips column 9
|________________X___|

libghostty-vt ignores CSI g without a parameter, so the tab stop at column 9 stays and the X lands there. Its dispatcher in src/terminal/stream.zig accepts the sequence only with exactly one parameter, and a left-out parameter is no parameter at all. ECMA-48 gives 0 as the default, DEC STD 070 says “an omitted parameter or a parameter value of zero” clears the stop at the cursor, the VT510 manual lists “0 or none (default)”, and esctest2’s test_TBC_Default checks for it.

TBC-3: Clear every stop

\e[?5W    # reset tab stops
\e[3g
\tX       # nothing to stop at but the right margin
|___________________X|

TBC-4: Where there is no stop

\e[?5W    # reset tab stops
\e[1;10H  # column 10 has no tab stop
\e[0g
\e[1;1H
\t\tX     # columns 9 and 17 are still stops
|________________X___|

TBC-5: Other values are ignored

\e[?5W    # reset tab stops
\e[1;9H
\e[2g     # ECMA-48's "stops in the active line"
\e[1;1H
\tX
|________X___________|
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.