HTS
HTS (Character Tabulation Set / Horizontal Tab Set) is a C1 control function that sets a tab stop at the current cursor column.
Syntax
ESC H HTS — Set tab stop (7-bit)
0x88 HTS — Set tab stop (8-bit C1)
HTS = ( 0x1b, "H" ) | 0x88 ;
Description
Per ECMA-48 §8.3.62, HTS "causes a character tabulation stop to be set at the active presentation position in the presentation component."
After issuing HTS, the current column becomes a tab stop. Subsequent HT (0x09) characters will advance the cursor to this column when the cursor is to its left.
Tab stops persist until explicitly cleared with TBC or until the terminal is reset. The default tab stops (every 8 columns) can be replaced by first clearing all stops with CSI 3 g (TBC) and then setting new ones with HTS at each desired position.
In 7-bit environments, HTS is sent as ESC H. Be careful not to confuse this with CSI H (CUP — Cursor Position), which moves the cursor to a specific row and column. The difference is the presence or absence of [ after ESC.
Examples
# Set custom tab stops at columns 5, 15, and 30
printf '\e[3g' # Clear all tab stops
printf '\e[5G\eH' # Move to column 5, set tab stop
printf '\e[15G\eH' # Move to column 15, set tab stop
printf '\e[30G\eH' # Move to column 30, set tab stop
Specifications
| Specification | Section |
|---|---|
| ECMA-48 | §8.3.62 |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | Yes | ESC H listed as IMPLEMENTED in docs/escape_support.md; handler set_horizontal_tabstop() at term/mod.rs:1479 |
| Bobcat | ✓ | 0.9.0 | Tab stop control, handled in TerminalCtrl library |
| contour | ✓ | v0.1.0 | ESC H implemented in processSequence; calls horizontalTabSet() |
| foot | ✓ | Yes | Implemented in vt.c:509-510 as ESC H, tab_set() at vt.c:444-462 |
| Ghostty | ✓ | v1.0.0 | ESC H handled in stream.zig:2192-2198 |
| iTerm2 | ✓ | Yes | |
| Kitty | ✓ | Yes | |
| Konsole | ✓ | Yes | |
| mintty | ✓ | Yes | Handled in do_esc() at src/termout.c:1982-1983 |
| mlterm | ✓ | rel-0_2_1 | |
| PuTTY | ✓ | 0.45 | |
| Rio | ✓ | v0.0.28 | |
| rxvt-unicode | ✓ | rxvt-unicode-1.2 | |
| st | ✓ | 0.4 | |
| terminology | ✓ | v1.0.0 | Accepted but not functional before v1.0.0 |
| VT100 | ✓ | Yes | |
| VTE | ✓ | Yes | |
| WezTerm | ✓ | Yes | Handled in performer.rs:448 via ControlCode::HTS and esc.rs:37 as EscCode::HorizontalTabSet |
| Windows Terminal | ✓ | Yes | ESC H dispatches HorizontalTabSet() in OutputStateMachineEngine.cpp:226-227 |
| xterm | ✓ | Yes | Implemented in charproc.c:5449 via TabSet() |
| xterm.js | ✓ | 3.5.0 | |
| Multiplexers | |||
| cy | ✓ | v0.1.0 | |
| GNU Screen | ✓ | v.4.2.0 | HTS (ESC H) implemented in DoESC() at src/ansi.c:721 |
| tmux | ✓ | 1.3 | Set tab stop at current column |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.7.0 | |
See also
- HT — Horizontal Tab — Advance to the next tab stop
- TBC — Tabulation Clear — Clear tab stops
- CHT/CBT — Cursor Tab Forward/Backward — CSI-based tab movement