^[control-codes live in libghostty-vt

Control sequences

DECSCL Select Conformance Level

Make the terminal behave as an earlier level of DEC terminal, with a soft reset.

CSI Pl ; Pc " p
DEC STD 070
§4, ch. 5 Select Conformance Level, p. 22
VT510
DECSCL—Select Conformance Level

Set the level the terminal operates at, so that it behaves like an older model for software written for one. Pl is the level as DA reports it: 61 for level 1 (a VT100), 62 for level 2 (a VT200), 63 and 64 for levels 3 and 4. For levels 2 and up, Pc chooses the controls the terminal sends: 1 for 7-bit, ESC [ and the like, and 0 or 2 for the 8-bit C1 bytes.

Changing level also performs a soft reset, like DECSTR: DEC STD 070 says selecting a level “causes a ‘soft reset’ of the terminal to be performed”, and that a level the terminal does not support is ignored. xterm’s source notes that the VT300, VT420 and VT520 manuals call it a full reset instead, and does the soft reset (CASE_DECSCL). xterm also refuses a level higher than its own terminal’s, so a VT420 cannot be set to level 5, and refuses any Pl below 61.

The level then decides what the terminal accepts. In xterm, control sequences with a $ intermediate, DECRQM among them, need level 3 (CASE_CSI_DOLLAR_STATE), and the left and right margins need level 4 (srm_DECLRMM). esctest2’s decscl.py tests both.

libghostty-vt does not implement DECSCL: its p dispatch in stream.zig handles only DECRQM, and logs any other intermediate as unimplemented. It keeps its one level, so it answers DECRQM and honors margins whatever is asked for, and it does not reset. The cases that depend on the level changing are known differences from xterm, a VT420 by default.

Validation

DECSCL-1: Level 2 has no DECRQM

\e[62;1"p # level 2, 7-bit controls
\e[4$p    # DECRQM for insert mode
|__________|
reply none

DECSCL-2: Level 3 has no left and right margins

\e[63;1"p # level 3
\e[?69h   # allow left and right margins
\e[5;6s   # margins at columns 5 and 6
\e[1;5H
abc
|____abc___|
|__________|
cursor 1,8

DECSCL-3: Level 4 has them

\e[64;1"p # level 4
\e[?69h   # allow left and right margins
\e[5;6s   # margins at columns 5 and 6
\e[1;5H
abc
|____ab____|
|____c_____|
cursor 2,6

DECSCL-4: Changing level is a soft reset

\e[4h     # insert mode
\e[64;1"p # level 4
\e[4$p    # DECRQM for insert mode
|__________|
reply \e[4;2$y

DECSCL-5: A level above the terminal’s own is refused

\e[4h     # insert mode
\e[65;1"p # level 5, more than a VT420
\e[4$p    # DECRQM for insert mode
|__________|
reply \e[4;1$y
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.