# Erasure Mode (ERM)

> Whether erasing touches protected areas.

- **Sequence:** `CSI 6 h/l`
- **ECMA-48:** [§7.2.4 ERM – Erasure Mode, p. 22](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n35/mode/1up)

Mode 6 decides whether the erasing functions, [ED](https://control-codes.page/csi/ed/index.html.md), [EL](https://control-codes.page/csi/el/index.html.md),
[ECH](https://control-codes.page/csi/ech/index.html.md), EA and EF, erase the characters in protected areas as well.
In ECMA-48 an area is protected with [SPA and EPA](https://control-codes.page/esc/spa/index.html.md), or with
DAQ.

| State | ECMA-48 calls it | Meaning |
| --- | --- | --- |
| Reset, `CSI 6 l` | PROTECT | only unprotected areas are erased |
| Set, `CSI 6 h` | ALL | protected areas are erased as well |

DEC STD 070 does not list it, and does not need it: a DEC terminal's
protection is [DECSCA](https://control-codes.page/csi/decsca/index.html.md), which only the selective erases,
DECSED and DECSEL, honor.

Neither xterm nor libghostty-vt implements it. Both ignore `CSI 6 h` and
`CSI 6 l`, and both answer [DECRQM](https://control-codes.page/csi/decrqm/index.html.md) with `0`, not
recognized: the mode is not among the ones xterm's [`do_ansi_rqm`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L5408-L5463) answers for.

## Support

| Terminal | Version | Support | Notes |
| --- | --- | --- | --- |
| VT220 | [manual](https://vt100.net/docs/vt220-rm/), 2nd ed., 1984 | No | not in the manual, whose table of ANSI modes has only KAM, IRM, SRM and LNM |
| VT510 | [manual](https://vt100.net/docs/vt510-rm/), 1st ed., 1993 | No | not in the manual |
| xterm | patch 412, [xterm-411a](https://github.com/ThomasDickey/xterm-snapshots/tree/xterm-411a) | No | ignored; DECRQM answers `0` |
| libghostty-vt | [0f171f6](https://github.com/ghostty-org/ghostty/tree/0f171f650a1cbbd6df4a2573b6b0c7de57cc6d90) | No | ignored; DECRQM answers `0` |
| ConEmu | build 230724, its [documentation](https://conemu.github.io/en/AnsiEscapeCodes.html) | No | not in its [ANSI escape codes](https://conemu.github.io/en/AnsiEscapeCodes.html) |

## Validation

### ERM-1: Not recognized

Input, one step per line:

```text
\e[6$p
```

Expected screen:

```text
|_____|
reply \e[6;0$y
```

### ERM-2: Not recognized after it is set, either

Input, one step per line:

```text
\e[6h
\e[6$p
```

Expected screen:

```text
|_____|
reply \e[6;0$y
```

---

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