DECSET DEC Private Mode Set
Turn one or more DEC private modes on.
CSI ? Pm h
- DEC STD 070
- §5.10.1.2 DEC Private Modes, p. 5-133
- VT220
- §4.6.1 Set Mode (SM)
- VT510
- SM—Set Mode
- xterm
- Functions using CSI
CSI ? Pm h sets one or more DEC private modes, and DECRST, CSI ? Pm l, resets them. It is SM with a ? in front of the parameters, which ECMA-48 leaves for private use, and the ? changes what every number means: CSI 4 h is insert mode, IRM, but CSI ? 4 h is smooth scrolling, DECSCLM. Each mode has a page under private modes.
DEC’s manuals do not call it DECSET. To them it is SM, Set Mode, with a ?: DEC STD 070 lists the private modes in its table of SM parameters, and the VT220 and VT510 manuals describe both forms under SM, and DECRST under RM. The names DECSET and DECRST are xterm’s, from its list of control sequences, and are the ones most documentation uses now.
Each parameter names one mode, and they are set in order. DEC STD 070 says a 0 is an error and is ignored, as is any number the terminal does not know, and that ANSI and private parameters cannot be mixed in one sequence. xterm handles each mode in turn in dpmodes, skipping those it does not know, and so does libghostty-vt.
A host can ask about one mode with DECRQM, CSI ? Pd $ p. xterm can also save the state of private modes with XTSAVE, CSI ? Pm s, and put it back with XTRESTORE, CSI ? Pm r.
Validation
DECSET-1: Two modes in one sequence
\e[?7;25l
\e[?7;25h # autowrap and the cursor
\e[?7$p
\e[?25$p
|_____|
reply \e[?7;1$y\e[?25;1$y
DECSET-2: Autowrap on again
\e[?7l
\e[?7h
ABCDEFG
|ABCDE|
|FG___|
cursor 2,3
DECSET-3: A mode that is not known does not stop the others
\e[?7l
\e[?0;9999;7h # 0 is an error, 9999 is no mode
ABCDEFG
|ABCDE|
|FG___|
cursor 2,3
DECSET-4: Without the question mark it is a different mode
\e[?7l
\e[7h # VEM, not DECAWM
ABCDEFG
|ABCDG|
|_____|
cursor 1,5