^[control-codes
live in libghostty-vt

ANSI modes

SRM Send/Receive Mode

View as Markdown

Turn local echo off and on.

CSI 12 h/l
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.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Yes§4.6.5 Send/Receive Mode (SRM)
VT510manual, 1st ed., 1993YesSRM
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yes
kitty0.49.1, run in a VMNofails the 3 cases that show it working
foot1.28.0, run in a VMNofails the 3 cases that show it working
xterm.js headless6.0.0, run as a libraryNofails the 3 cases that show it working
alacritty_terminal0.26.0, run as a libraryNofails the 3 cases that show it working
ConEmubuild 230724, its documentationNonot in its ANSI escape codes
rxvt-unicode9.31, run in a VMNofails the 3 cases that show it working
VTE0.84.1, run as a libraryNofails the 3 cases that show it working

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.