# Guarded Area Transfer Mode (GATM)

> Whether guarded areas are left out when the screen is sent to the host.

- **Sequence:** `CSI 1 h`
- **ECMA-48:** [§7.2.7 GATM – Guarded Area Transfer Mode, p. 23](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n36/mode/1up)

Mode 1 decides whether the contents of *guarded* areas are sent when the
terminal transmits the screen to the host. A guarded area is one marked off
with [SPA and EPA](https://control-codes.page/esc/spa/index.html.md). Terminals that do not
transmit their screen have no use for it.

| State | ECMA-48 calls it | Meaning |
| --- | --- | --- |
| Reset, `CSI 1 l` | GUARD | only the unguarded areas are sent |
| Set, `CSI 1 h` | ALL | the guarded areas are sent as well |

DEC STD 070 does not list it, but the VT510 manual's table of ANSI modes for
DECRPM gives it as permanently reset, and DEC STD 070 says DECRQM reports
every X3.64 mode as set or reset.

xterm ignores `CSI 1 h` and `CSI 1 l` ([`ansi_modes`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/charproc.c#L7399-L7424) handles only modes 2,
4, 12 and 20), and [DECRQM](https://control-codes.page/csi/decrqm/index.html.md) reports the mode as permanently
reset, `4` ([`do_ansi_rqm`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L5408-L5463)). libghostty-vt ignores it too, but does not recognize the
number, so it answers DECRQM with `0`. Both DECRQM cases are known
differences.

## Validation

### GATM-1: Reported as permanently reset

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

Input, one step per line:

```text
\e[1$p
```

Expected screen:

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

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

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

Input, one step per line:

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

Expected screen:

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

---

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