^[control-codes live in libghostty-vt

Control sequences

MC Media Copy

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

CSI Ps i
Defaults
Ps = 0
ECMA-48
§8.3.82 MC – Media Copy, p. 50
DEC STD 070
§7.7 Set/Reset Printer Controller Mode, p. 7-34
VT510
MC—Media Copy

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:

PsDoes
0print the screen
5printer controller mode on: everything the host sends goes to the printer, and none of it to the screen
4printer 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). 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), and with no printer command “we will ignore printer controls” (print.c), so a default xterm behaves as these cases expect.

Validation

MC-1: Print screen is ignored

AB
\e[i
C
|ABC__|
reply none

MC-2: No printer controller mode

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