^[control-codes live in libghostty-vt

ANSI modes

GRCM Graphic Rendition Combination Mode

Whether each SGR replaces the rendition or adds to it.

CSI 21 h
ECMA-48
§7.2.8 GRCM – Graphic Rendition Combination Mode, p. 23

Mode 21 decides what an SGR does to the attributes already in effect. Reset, which ECMA-48 makes the default, each SGR replaces them: anything not named in it is turned off. Set, it changes only what it names.

StateECMA-48 calls itMeaning
Reset, CSI 21 lREPLACINGeach SGR cancels the one before
Set, CSI 21 hCUMULATIVEeach SGR changes only what it names

xterm and libghostty-vt behave as if the mode were set. ECMA-48’s default would have bold, then underline, give an underlined character that is not bold.

Neither xterm nor libghostty-vt implements it. Both ignore CSI 21 h and CSI 21 l, and both answer DECRQM with 0, not recognized: the mode is not among the ones xterm’s do_ansi_rqm answers for.

Validation

GRCM-1: Not recognized

\e[21$p
|_____|
reply \e[21;0$y

GRCM-2: Not recognized after it is set, either

\e[21h
\e[21$p
|_____|
reply \e[21;0$y

GRCM-3: SGR is cumulative, even with the mode reset

\e[21l     # ignored
\e[1m       # bold
\e[4m       # underline
X
|X__|
attr 1,1 bold underline
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.