RM Reset Mode
Turn one or more ANSI modes off.
CSI Pm l
- ECMA-48
- §8.3.106 RM – Reset Mode, p. 56
- DEC STD 070
- §5.10.1 SM/RM – Set Mode, Reset Mode, p. 5-133
- VT220
- §4.6.2 Reset Mode (RM)
- VT510
- RM—Reset Mode
CSI Pm l resets one or more modes, the ones SM sets. Each parameter names one mode, the modes are reset in order, and ECMA-48 gives no default. The numbers are the ANSI modes, and the table on the SM page says which of them xterm and libghostty-vt keep: KAM, IRM, SRM and LNM. Every other number is ignored, and DEC STD 070 and the VT220 manual both say that a 0 is an error, ignored.
ECMA-48 calls the reset state of each mode the first one, and recommends it as the default, so RM usually puts a mode back the way it started. Not always: send/receive mode, SRM, starts set on DEC terminals and in xterm, and CSI 12 l turns local echo on.
RM has one privilege in ECMA-48. In the graphic state of control representation mode, CRM, every control function is shown rather than performed, except RM, so that CSI 3 l can still turn the mode off. Neither xterm nor libghostty-vt has that state.
ANSI modes and DEC private modes cannot be mixed in one sequence. The DEC private form, CSI ? Pm l, is DECRST.
Support
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | Yes | §4.6.2 Reset Mode (RM) |
| VT510 | manual, 1st ed., 1993 | Yes | RM |
| xterm | patch 412, xterm-411a | Yes | KAM, IRM, SRM and LNM |
| libghostty-vt | 0f171f6 | Yes | KAM, IRM, SRM and LNM |
| kitty | 0.49.1, run in a VM | Partly | fails RM-4 of the 4 cases that show it working |
| foot | 1.28.0, run in a VM | Partly | fails RM-3, RM-4 of the 4 cases that show it working |
| pyte | 0.8.2, run as a library | Yes | passes the 3 cases that show it working |
| xterm.js headless | 6.0.0, run as a library | Partly | fails RM-4 of the 4 cases that show it working |
| alacritty_terminal | 0.26.0, run as a library | Partly | fails RM-4 of the 4 cases that show it working |
| ConEmu | build 230724, its documentation | Partly | lists only 20 (LNM) and its own 7, line wrapping; ANSI escape codes |
| rxvt-unicode | 9.31, run in a VM | Partly | fails RM-3, RM-4 of the 4 cases that show it working |
| VTE | 0.84.1, run as a library | Partly | fails RM-4 of the 4 cases that show it working |
Validation
RM-1: Two modes in one sequence
\e[4;20h
\e[4;20l # IRM and LNM
abc
\e[1;1H
X
\n
Y
|Xbc__|
|_Y___|
cursor 2,3
RM-2: Only the modes it names
\e[4;20h
\e[20l # LNM only
abc
\e[1;1H
X # still inserts
\n
Y
|Xabc_|
|_Y___|
cursor 2,3
RM-3: A mode that is not known does not stop the others
\e[4h
\e[0;99;4l # 0 is an error, 99 is no mode
abc
\e[1;1H
X
|Xbc__|
cursor 1,2
RM-4: Resetting SRM turns local echo on
\e[12l
\e[12$p
|_____|
reply \e[12;2$y
RM-5: A question mark makes it a different mode
\e[4h
\e[?4l # DECSCLM, not IRM
abc
\e[1;1H
X
|Xabc_|
cursor 1,2