^[control-codes
live in libghostty-vt

ANSI modes

View as Markdown

The 22 modes ECMA-48 numbers, set with CSI Pm h and reset with CSI Pm l (SM and RM), each named by a number with no ? in front. ECMA-48 calls the first state of each the reset state and recommends it as the default.

Most of them are for block-mode terminals, which edit a screen locally and send it to the host, or for devices that handle bidirectional text, and DEC’s terminals took up only four: KAM, IRM, SRM and LNM. xterm and libghostty-vt take the same four and ignore the rest, but answer differently when DECRQM asks about them: xterm reports most of them as permanently reset, as the VT510 does, and libghostty-vt as not recognized.

The modes with a ?, which DEC and xterm defined, are the private modes.

1 GATMGuarded Area Transfer Mode CSI 1 h/l …
2 KAMKeyboard Action Mode CSI 2 h/l …
3 CRMControl Representation Mode CSI 3 h/l …
4 IRMInsertion Replacement Mode CSI 4 h/l …
5 SRTMStatus Report Transfer Mode CSI 5 h/l …
6 ERMErasure Mode CSI 6 h/l …
7 VEMLine Editing Mode CSI 7 h/l …
8 BDSMBi-directional Support Mode CSI 8 h/l …
9 DCSMDevice Component Select Mode CSI 9 h/l …
10 HEMCharacter Editing Mode CSI 10 h/l …
11 PUMPositioning Unit Mode CSI 11 h/l …
12 SRMSend/Receive Mode CSI 12 h/l …
13 FEAMFormat Effector Action Mode CSI 13 h/l …
14 FETMFormat Effector Transfer Mode CSI 14 h/l …
15 MATMMultiple Area Transfer Mode CSI 15 h/l …
16 TTMTransfer Termination Mode CSI 16 h/l …
17 SATMSelected Area Transfer Mode CSI 17 h/l …
18 TSMTabulation Stop Mode CSI 18 h/l …
19 EBMEditing Boundary Mode CSI 19 h/l …
20 LNMLine Feed/New Line Mode CSI 20 h/l …
21 GRCMGraphic Rendition Combination Mode CSI 21 h/l …
22 ZDMZero Default Mode CSI 22 h/l …
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.