# Text Cursor Enable Mode (DECTCEM)

> Show or hide the cursor.

- **Sequence:** `CSI ? 25 h/l`
- **DEC STD 070:** [§5.4.2 Set/Reset Text Cursor Enable Mode, p. 5-21](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n275/mode/1up)
- **VT220:** [§4.6.7 Text Cursor Enable Mode (DECTCEM)](https://vt100.net/docs/vt220-rm/chapter4.html#S4.6.7)
- **VT510:** [DECTCEM—Text Cursor Enable Mode](https://vt100.net/docs/vt510-rm/DECTCEM.html)

`CSI ? 25 h` shows the cursor and `CSI ? 25 l` hides it. Shown is the
default.

Only the cursor's symbol on the screen is affected. A hidden cursor still
has its position, still moves, and text is still written where it is.
DEC STD 070 asks that turning it off be immediate, and
suggests that a terminal's setup screen offer a way to turn it back on, in
case a program forgets to.

On this site the cursor's cell is outlined in the drawn terminal only while
it is visible; the `cursor-visible` line in a case checks the mode itself.

## Support

| Terminal | Version | Support | Notes |
| --- | --- | --- | --- |
| VT220 | [manual](https://vt100.net/docs/vt220-rm/), 2nd ed., 1984 | Yes | [§4.6.7 Text Cursor Enable Mode (DECTCEM)](https://vt100.net/docs/vt220-rm/chapter4.html#S4.6.7) |
| VT510 | [manual](https://vt100.net/docs/vt510-rm/), 1st ed., 1993 | Yes | [DECTCEM](https://vt100.net/docs/vt510-rm/DECTCEM.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 3 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) | Yes | passes 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) | Yes | passes the 2 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) | Yes | [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 |

## Validation

### DECTCEM-1: Hidden where it is

Input, one step per line:

```text
\e[2;3H
\e[?25l
```

Expected screen:

```text
|_____|
|_____|
cursor 2,3
cursor-visible no
```

### DECTCEM-2: Text is still written

Input, one step per line:

```text
\e[?25l
AB
```

Expected screen:

```text
|AB___|
cursor 1,3
cursor-visible no
```

### DECTCEM-3: Shown again

Input, one step per line:

```text
\e[?25l
\e[?25h
```

Expected screen:

```text
|_____|
cursor-visible yes
```

### DECTCEM-4: Shown to begin with

Input, one step per line:

```text
\e[?25$p  # DECRQM: is mode 25 set?
```

Expected screen:

```text
|_____|
cursor-visible yes
reply \e[?25;1$y
```

---

This is the Markdown version of <https://control-codes.page/modes/dectcem/>. 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>.
