^[control-codes
live in libghostty-vt

ANSI modes

ZDM Zero Default Mode

View as Markdown

Whether a parameter of 0 means zero or the default.

CSI 22 h/l
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.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Nonot in the manual, whose table of ANSI modes has only KAM, IRM, SRM and LNM
VT510manual, 1st ed., 1993Nonot in the manual
xtermpatch 412, xterm-411aNoignored; DECRQM answers 0
libghostty-vt0f171f6Noignored; DECRQM answers 0
ConEmubuild 230724, its documentationNonot in its ANSI escape codes

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.