GRCM Graphic Rendition Combination Mode
Whether each SGR replaces the rendition or adds to it.
CSI 21 h
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.
| State | ECMA-48 calls it | Meaning |
|---|---|---|
Reset, CSI 21 l | REPLACING | each SGR cancels the one before |
Set, CSI 21 h | CUMULATIVE | each 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