# Media Copy (MC)

> Print the screen, or send what the host sends to a printer instead of the screen.

- **Sequence:** `CSI Ps i`
- **Defaults:** Ps = 0
- **ECMA-48:** [§8.3.82 MC – Media Copy, p. 50](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n63/mode/1up)
- **DEC STD 070:** [§7.7 Set/Reset Printer Controller Mode, p. 7-34](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n712/mode/1up)
- **VT510:** [MC—Media Copy](https://vt100.net/docs/vt510-rm/MC.html)

MC talks to an *auxiliary device*: on a DEC terminal, the printer plugged
into its printer port. ECMA-48 defines what `Ps` does in general terms; the
DEC terminals' meanings are:

| `Ps` | Does |
| --- | --- |
| `0` | print the screen |
| `5` | printer controller mode on: everything the host sends goes to the printer, and none of it to the screen |
| `4` | printer controller mode off |

With a `?`, `CSI ? Ps i` is DEC's own set, which adds printing the cursor's
line and an autoprint mode.

All of this is DEC STD 070's Printer Port Extension, section 7, an optional
extension for terminals that have a printer port. libghostty-vt has none,
does not implement MC, and so ignores it, as DEC STD 070 says a terminal
should ignore any function it does not implement
([§3.5.1.3, p. 3-20](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n124/mode/1up)).
In particular, `CSI 5 i` does not hide what follows it: with no printer
controller mode, the text is shown as usual. xterm does implement MC, but
only once it is given a printer command to send to. Its `printerCommand`
is empty by default
([`charproc.c`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/charproc.c#L536)),
and with no printer command "we will ignore printer controls"
([`print.c`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/print.c#L680-L688)),
so a default xterm behaves as these cases expect.

## Validation

### MC-1: Print screen is ignored

Input, one step per line:

```text
AB
\e[i
C
```

Expected screen:

```text
|ABC__|
reply none
```

### MC-2: No printer controller mode

Input, one step per line:

```text
A
\e[5i     # printer controller mode on
B         # would go to the printer
\e[4i     # printer controller mode off
C
```

Expected screen:

```text
|ABC__|
```

---

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