^[control-codes live in libghostty-vt

ANSI modes

CRM Control Representation Mode

Show control characters as graphic symbols instead of performing them.

CSI 3 h
ECMA-48
§7.2.2 CRM – Control Representation Mode, p. 22
VT220
§2.7 Display Controls Mode
VT510
CRM—Show Control Character Mode

Mode 3 turns the terminal into a display of what it receives. Set, control functions are shown as graphic symbols rather than performed; reset, which is the default, they are performed.

StateECMA-48 calls itMeaning
Reset, CSI 3 lCONTROLcontrol functions are performed
Set, CSI 3 hGRAPHICcontrol functions, except RM, are shown as graphic characters

RM is the exception so that CSI 3 l can still turn the mode off.

DEC terminals call it Show Control Character Mode. The VT510 manual describes CRM with a special font for the controls: every control is shown, and only LF, FF and VT are also performed, as a new line. The VT510 lets the host set it with CSI 3 h. The VT220 did not: its manual (§2.7) calls it display controls mode, selected only in Set-Up, and says no escape sequence turns it on. DEC STD 070 does not list it among the modes a host can set either.

xterm has no such mode. ansi_modes ignores CSI 3 h, and controls keep working afterwards. DECRQM reports it as reset, 2, rather than as permanently reset (do_ansi_rqm), which says it is a mode xterm knows. libghostty-vt ignores CSI 3 h as well, but does not recognize the number, and answers 0. So the DECRQM cases are known differences, and the case showing that the controls still work is not.

Validation

CRM-1: Reported as reset

\e[3$p
|_____|
reply \e[3;2$y

CRM-2: Even after it is set

\e[3h
\e[3$p
|_____|
reply \e[3;2$y

CRM-3: Controls are still performed

\e[3h    # ignored
AB
\r
C
|CB___|
cursor 1,2
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.