^[control-codes live in libghostty-vt

ANSI modes

ZDM Zero Default Mode

Whether a parameter of 0 means zero or the default.

CSI 22 h
ECMA-48
§F.4.2 ZDM – Zero Default Mode, p. 87

Mode 22 decides what a parameter of 0 means. Reset, it means the number zero; set, it means the default, so CSI 0 C moves one column like CSI C. The first edition of ECMA-48 treated 0 as the default, and the mode was kept for implementations of it; the fifth edition deprecates it and moved it to an annex.

StateECMA-48 calls itMeaning
Reset, CSI 22 lZERO0 is the number zero
Set, CSI 22 hDEFAULT0 is the default value

Terminals behave as if the mode were set. In xterm and libghostty-vt a 0 given to a count, as in CUF or ICH, means one, the same as leaving it out, whatever the mode says.

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

Validation

ZDM-1: Not recognized

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

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

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

ZDM-3: A zero is still the default

\e[22l     # zero means zero: ignored
A
\e[0C       # moves one column
B
|A_B__|
cursor 1,4
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.