# Cursor Horizontal Tabulation (CHT)

> Move the cursor forward n tab stops.

- **Sequence:** `CSI Pn I`
- **Defaults:** Pn = 1
- **ECMA-48:** [§8.3.10 CHT – Cursor Forward Tabulation, p. 34](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n47/mode/1up)
- **VT510:** [CHT—Cursor Horizontal Forward Tabulation](https://vt100.net/docs/vt510-rm/CHT.html)

Do what a [horizontal tab](https://control-codes.page/c0/ht/index.html.md) does, `Pn` times: move the cursor right
to the next tab stop, stopping at the right margin if there are no more. A
`0` is taken as `1`. [CBT](https://control-codes.page/csi/cbt/index.html.md) goes the other way.

## Support

| Terminal | Version | Support | Notes |
| --- | --- | --- | --- |
| VT220 | [manual](https://vt100.net/docs/vt220-rm/), 2nd ed., 1984 | No | not in the manual |
| VT510 | [manual](https://vt100.net/docs/vt510-rm/), 1st ed., 1993 | Yes | [CHT](https://vt100.net/docs/vt510-rm/CHT.html) |
| xterm | patch 412, [xterm-411a](https://github.com/ThomasDickey/xterm-snapshots/tree/xterm-411a) | Yes |  |
| libghostty-vt | [0f171f6](https://github.com/ghostty-org/ghostty/tree/0f171f650a1cbbd6df4a2573b6b0c7de57cc6d90) | Yes |  |
| kitty | 0.49.1, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/kitty.json) | Yes | passes the 2 cases that show it working |
| foot | 1.28.0, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/foot.json) | Partly | fails CHT-3 of the 3 cases that show it working |
| pyte | 0.8.2, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/pyte.json) | No | fails the 3 cases that show it working |
| xterm.js headless | 6.0.0, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/xtermjs.json) | Yes | passes the 3 cases that show it working |
| alacritty_terminal | 0.26.0, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/alacritty.json) | Yes | passes the 3 cases that show it working |
| ConEmu | build 230724, its [documentation](https://conemu.github.io/en/AnsiEscapeCodes.html) | No | not in its list: [ANSI escape codes](https://conemu.github.io/en/AnsiEscapeCodes.html) |
| rxvt-unicode | 9.31, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/urxvt.json) | Yes | passes the 3 cases that show it working |
| VTE | 0.84.1, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/vte.json) | Yes | passes the 3 cases that show it working |

## Validation

### CHT-1: One tab stop

Input, one step per line:

```text
\e[?5W    # reset tab stops
\e[I
X
```

Expected screen:

```text
|________X___________|
```

### CHT-2: Several tab stops

Input, one step per line:

```text
\e[?5W    # reset tab stops
\e[2I
X
```

Expected screen:

```text
|________________X___|
```

### CHT-3: Stops at the right margin

Input, one step per line:

```text
\e[?5W    # reset tab stops
\e[9I
X
```

Expected screen:

```text
|___________________X|
```

---

This is the Markdown version of <https://control-codes.page/csi/cht/>. On that page every validation case runs live in libghostty-vt, the terminal emulation core of Ghostty, compiled to WebAssembly.

The validation cases are written in the notation described in <https://control-codes.page/notation/index.html.md>.
