HT
HT (Character Tabulation / Horizontal Tab) is a C0 control character that advances the cursor to the next tab stop.
Syntax
HT 0x09
HT = 0x09 ;
Description
Per ECMA-48 §8.3.60, HT "causes the active presentation position to be moved to the following character tabulation stop in the presentation component."
By default, tab stops are set every 8 columns (columns 1, 9, 17, 25, ...). Tab stops can be modified using HTS (set a tab stop at the current column), TBC (clear tab stops), or the DECST8C sequence.
If there are no more tab stops between the cursor and the right margin, behavior varies by terminal. Most terminals move the cursor to the last column of the line.
HT does not erase characters between the current cursor position and the destination tab stop. The intervening cells are typically filled with spaces in the display, but the cursor simply jumps to the next stop position.
Examples
printf 'A\tB\tC' # Print A, B, C separated by tab stops
printf '\e[3g' # Clear all tab stops (TBC)
printf '\eH' # Set a tab stop at the current column (HTS)
Specifications
| Specification | Section |
|---|---|
| ECMA-48 | §8.3.60 |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | Yes | Handler put_tab() at term/mod.rs:1366, respects tab stops |
| Bobcat | ✓ | 0.9.0 | Tab stops referenced in termios config (Terminal.cpp:78-91) |
| contour | ✓ | v0.1.0 | Implemented in executeControlCode; calls moveCursorToNextTab() |
| foot | ✓ | Yes | Implemented in vt.c:169-224 |
| Ghostty | ✓ | v1.0.0 | Handled in stream.zig:769 as C0.HT (0x09) |
| iTerm2 | ✓ | Yes | |
| Kitty | ✓ | Yes | |
| Konsole | ✓ | Yes | |
| mintty | ✓ | Yes | Handled in do_ctrl() at src/termout.c:1693 |
| mlterm | ✓ | rel-0_2_1 | |
| PuTTY | ✓ | 0.45 | |
| Rio | ✓ | v0.0.28 | |
| rxvt-unicode | ✓ | rxvt-unicode-1.2 | |
| st | ✓ | 0.6 | |
| terminology | ✓ | v0.1.0 | |
| VT100 | ✓ | Yes | |
| VTE | ✓ | Yes | |
| WezTerm | ✓ | Yes | Handled in performer.rs:447 via ControlCode::HorizontalTab, calls c0_horizontal_tab() |
| Windows Terminal | ✓ | Yes | Handled via ForwardTab(1) dispatch in OutputStateMachineEngine.cpp:62-63 |
| xterm | ✓ | Yes | Implemented in charproc.c:3763. Horizontal tab via TabToNextStop() |
| xterm.js | ✓ | 2.3.0 | |
| Multiplexers | |||
| cy | ✓ | v0.1.0 | |
| GNU Screen | ✓ | v.4.2.0 | Implemented in Special() function at src/ansi.c:694 |
| tmux | ✓ | 0.8 | Moves cursor to next tab stop, respects tab array |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.5.0-beta | |
See also
- HTS — Set Tab Stop — Set a tab stop at the current column
- CHT/CBT — Cursor Tab Forward/Backward — CSI sequences for tabulation
- TBC — Tabulation Clear — Clear tab stops