^[control-codes live in libghostty-vt

ANSI modes

SRM Send/Receive Mode

Turn local echo off and on.

CSI 12 h
ECMA-48
§7.2.15 SRM – Send/Receive Mode, p. 24
DEC STD 070
§5.10.2 Send Receive Mode, p. 5-135
VT220
§4.6.5 Send/Receive Mode (SRM)
VT510
SRM—Local Echo: Send/Receive Mode
xterm
Functions using CSI

Mode 12 is local echo. Reset (CSI 12 l), what is typed is shown on the screen by the terminal itself as well as being sent; set (CSI 12 h), it is only sent, and the host echoes it if it wants it seen.

StateECMA-48 calls itMeaning
Reset, CSI 12 lMONITORwhat is typed is shown at once
Set, CSI 12 hSIMULTANEOUSonly what the host sends is shown

Unusually, the set state is the default. ECMA-48 recommends that every mode start reset, but DEC STD 070 (§5.10.2, p. 5-135) and the VT510 manual make no local echo the default, and so does xterm: it sets the mode when it starts and on a reset (charproc.c).

xterm keeps the mode, and when it is reset, it parses what it sends as if the host had sent it (charproc.c). That is input, which this site cannot type, so nothing on the screen changes here. libghostty-vt keeps the mode, set by default, and both answer DECRQM with its state.

Validation

SRM-1: Set by default

\e[12$p
|_____|
reply \e[12;1$y

SRM-2: Reset

\e[12l
\e[12$p
|_____|
reply \e[12;2$y

SRM-3: And set again

\e[12l
\e[12h
\e[12$p
|_____|
reply \e[12;1$y
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.