# Printer Modes (DECPEX, DECPFF)

> Choose what a print operation sends to the printer, and whether it ends with a form feed.

- **Sequence:** `CSI ? 19 h`
- **Defaults:** reset
- **DEC STD 070:** [§7.7 Set/Reset Print Extent Mode, p. 7-38](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n716/mode/1up)
- **VT510:** [DECPEX—Printer Extent Mode](https://vt100.net/docs/vt510-rm/DECPEX.html)

Two modes of DEC's printer port extension, which change what a print
operation, such as [MC](https://control-codes.page/csi/mc/index.html.md)'s print screen, sends:

| Mode | Name | Set | Reset |
| --- | --- | --- | --- |
| `19` | DECPEX, print extent | print the whole display | print only the scrolling region |
| `18` | DECPFF, print form feed | end each print with a form feed | no form feed |

DECPFF is on [p. 7-37](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n715/mode/1up) of DEC STD 070, and is
[DECPFF](https://vt100.net/docs/vt510-rm/DECPFF.html) in the VT510 manual.
Neither changes the screen.

xterm keeps both modes, reset by default (its `printerExtent` and
`printerFormFeed` resources are false,
[`charproc.c`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/charproc.c#L463-L464)), sets them
([`charproc.c`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/charproc.c#L7644-L7649)) and reports them through
[DECRQM](https://control-codes.page/csi/decrqm/index.html.md) ([`do_dec_rqm`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L5544-L5549)), whether or
not it has a printer to send to. A default xterm has none (see
[MC](https://control-codes.page/csi/mc/index.html.md)).

libghostty-vt does not have the modes: neither is in its table in
`modes.zig`, so DECRQM reports each as not recognized, `0`. Both cases are
known differences.

## Validation

### DECPEX-1: Both reset by default

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

Input, one step per line:

```text
\e[?19$p\e[?18$p
```

Expected screen:

```text
|_____|
reply \e[?19;2$y\e[?18;2$y
```

### DECPEX-2: Set

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

Input, one step per line:

```text
\e[?19h\e[?18h
\e[?19$p\e[?18$p
```

Expected screen:

```text
|_____|
reply \e[?19;1$y\e[?18;1$y
```

---

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