# Autorepeat Mode (DECARM)

> Turn the repeating of held-down keys on and off.

- **Sequence:** `CSI ? 8 h`
- **DEC STD 070:** [§6.6.3 Set/Reset Auto Repeat Mode, p. 6-41](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n527/mode/1up)
- **VT510:** [DECARM—Autorepeat Mode](https://vt100.net/docs/vt510-rm/DECARM.html)

Mode 8 decides whether a key held down repeats. Set (`CSI ? 8 h`), most keys
repeat while held; reset (`CSI ? 8 l`), none do. The VT510 manual makes
repeating the default. It changes only what the keyboard sends, which this
site cannot press, so nothing on the screen changes.

DEC STD 070 calls autorepeat a user preference, which software should change
only when the user asks it to.

xterm does not let a program change it. It ignores the mode
([`charproc.c`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/charproc.c#L7607-L7612)): its comment explains that the X
functions to turn autorepeat on and off work only for the whole display, not
one window. And [DECRQM](https://control-codes.page/csi/decrqm/index.html.md) always reports it as permanently reset,
`4` ([`do_dec_rqm`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L5505-L5507)). esctest2, the test suite for
xterm's behavior, expects the mode to change and lists xterm's answer as a
known bug ("xterm always returns 4 (permanently reset)"), but this site's
rule is to follow xterm, bugs included, so the cases expect `4`.

libghostty-vt keeps the mode, and reports it as reset (`2`) until it is set,
then set (`1`): mode 8 is in its mode table, in `modes.zig`. So the two DECRQM
cases are known differences. libghostty-vt's answer is the one esctest2
expects.

## Validation

### DECARM-1: Reported as permanently reset

*A known difference: libghostty-vt does not pass this case.*

Input, one step per line:

```text
\e[?8$p
```

Expected screen:

```text
|_____|
reply \e[?8;4$y
```

### DECARM-2: Even after it is set

*A known difference: libghostty-vt does not pass this case.*

Input, one step per line:

```text
\e[?8h
\e[?8$p
```

Expected screen:

```text
|_____|
reply \e[?8;4$y
```

### DECARM-3: Nothing on the screen changes

Input, one step per line:

```text
A
\e[?8h
B
\e[?8l
C
```

Expected screen:

```text
|ABC__|
cursor 1,4
```

---

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