# ANSI modes

> The modes ECMA-48 numbers, turned on with CSI Pm h and off with CSI Pm l, and asked about with DECRQM.

The 22 modes ECMA-48 numbers, set with `CSI Pm h` and reset with `CSI Pm l`
([SM](https://control-codes.page/csi/sm/index.html.md) and [RM](https://control-codes.page/csi/rm/index.html.md)), 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](https://control-codes.page/csi/decrqm/index.html.md) 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](https://control-codes.page/modes/index.html.md).

- [BDSM: Bi-directional Support Mode](https://control-codes.page/ansi/bdsm/index.html.md): Whether the terminal or the host handles bidirectional text.
- [HEM: Character Editing Mode](https://control-codes.page/ansi/hem/index.html.md): Which way characters move when one is inserted or deleted.
- [CRM: Control Representation Mode](https://control-codes.page/ansi/crm/index.html.md): Show control characters as graphic symbols instead of performing them.
- [DCSM: Device Component Select Mode](https://control-codes.page/ansi/dcsm/index.html.md): Whether editing functions act on the presentation or the data.
- [EBM: Editing Boundary Mode](https://control-codes.page/ansi/ebm/index.html.md): A mode ECMA-48 has removed.
- [ERM: Erasure Mode](https://control-codes.page/ansi/erm/index.html.md): Whether erasing touches protected areas.
- [FEAM: Format Effector Action Mode](https://control-codes.page/ansi/feam/index.html.md): Whether formatting functions are performed or only stored.
- [FETM: Format Effector Transfer Mode](https://control-codes.page/ansi/fetm/index.html.md): Whether formatting functions may be added to what is transmitted.
- [GRCM: Graphic Rendition Combination Mode](https://control-codes.page/ansi/grcm/index.html.md): Whether each SGR replaces the rendition or adds to it.
- [GATM: Guarded Area Transfer Mode](https://control-codes.page/ansi/gatm/index.html.md): Whether guarded areas are left out when the screen is sent to the host.
- [IRM: Insertion Replacement Mode](https://control-codes.page/ansi/irm/index.html.md): Insert characters instead of writing over them.
- [KAM: Keyboard Action Mode](https://control-codes.page/ansi/kam/index.html.md): Lock and unlock the keyboard.
- [VEM: Line Editing Mode](https://control-codes.page/ansi/vem/index.html.md): Which way lines move when one is inserted or deleted.
- [LNM: Line Feed/New Line Mode](https://control-codes.page/ansi/lnm/index.html.md): Make a line feed return to the first column as well.
- [MATM: Multiple Area Transfer Mode](https://control-codes.page/ansi/matm/index.html.md): Whether one selected area or all of them is transmitted.
- [PUM: Positioning Unit Mode](https://control-codes.page/ansi/pum/index.html.md): Whether cursor movement counts in characters or in SSU units.
- [SATM: Selected Area Transfer Mode](https://control-codes.page/ansi/satm/index.html.md): Whether only selected areas are transmitted.
- [SRM: Send/Receive Mode](https://control-codes.page/ansi/srm/index.html.md): Turn local echo off and on.
- [SRTM: Status Report Transfer Mode](https://control-codes.page/ansi/srtm/index.html.md): Whether a status report goes with every transmission.
- [TSM: Tabulation Stop Mode](https://control-codes.page/ansi/tsm/index.html.md): Whether a tab stop applies to every line or only one.
- [TTM: Transfer Termination Mode](https://control-codes.page/ansi/ttm/index.html.md): Whether a transmission stops at the cursor.
- [ZDM: Zero Default Mode](https://control-codes.page/ansi/zdm/index.html.md): Whether a parameter of 0 means zero or the default.

---

This is the Markdown version of <https://control-codes.page/ansi/>. On that page every validation case runs live in libghostty-vt, the terminal emulation core of Ghostty, compiled to WebAssembly.
