# 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/l`
- **Defaults:** reset
- **DECPFF**, Print Form Feed Mode: `CSI ? 18 h/l`
- **DEC STD 070:** [§7.7 Set/Reset Print Extent Mode, p. 7-38](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n716/mode/1up)
- **VT220:** [§4.6.17 Print Extent Mode (DECPEX)](https://vt100.net/docs/vt220-rm/chapter4.html#S4.6.17)
- **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.

## Support

| Terminal | Version | Support | Notes |
| --- | --- | --- | --- |
| VT220 | [manual](https://vt100.net/docs/vt220-rm/), 2nd ed., 1984 | Yes | [§4.6.17 Print Extent Mode (DECPEX)](https://vt100.net/docs/vt220-rm/chapter4.html#S4.6.17) and [§4.6.16 Print Form Feed Mode (DECPFF)](https://vt100.net/docs/vt220-rm/chapter4.html#S4.6.16) |
| VT510 | [manual](https://vt100.net/docs/vt510-rm/), 1st ed., 1993 | Yes | [DECPEX](https://vt100.net/docs/vt510-rm/DECPEX.html) and [DECPFF](https://vt100.net/docs/vt510-rm/DECPFF.html) |
| xterm | patch 412, [xterm-411a](https://github.com/ThomasDickey/xterm-snapshots/tree/xterm-411a) | Yes | keeps and reports both modes; a default xterm has no printer |
| libghostty-vt | [0f171f6](https://github.com/ghostty-org/ghostty/tree/0f171f650a1cbbd6df4a2573b6b0c7de57cc6d90) | No | neither is in its mode table; DECRQM reports `0` (DECPEX-1, DECPEX-2) |
| kitty | 0.49.1, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/kitty.json) | No | fails the 2 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) | No | fails 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) | No | fails the 2 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) | No | fails the 2 cases that show it working |
| ConEmu | build 230724, its [documentation](https://conemu.github.io/en/AnsiEscapeCodes.html) | No | not in ConEmu's list, [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) | No | fails the 2 cases that show it working |
| VTE | 0.84.1, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/vte.json) | No | fails the 2 cases that show it working |

## 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>.
