ESC Escape
Begin an escape sequence, abandoning any sequence already in progress.
ESC
- ECMA-48
- §8.3.48 ESC – Escape, p. 43
- DEC STD 070
- §3.5.1.2.3 Escape, p. 3-19
- VT220
- §4.2 Control Characters
- VT510
- 4.2 Control Characters
ESC begins an escape sequence: it “causes the meanings of a limited number of bit combinations following it in the data stream to be changed”, in ECMA-48’s words, which leaves the rules for what may follow to ECMA-35. Every multi-byte sequence on this site starts with it, including the control sequences, whose introducer CSI is written ESC [ in a 7-bit stream.
An ESC that arrives while a sequence is still in progress abandons that sequence and starts a new one. DEC STD 070 says “the sequence is canceled and a new sequence begins with that ESC”, and the VT510 manual (§4.3.5) that ESC can be sent “to cancel a sequence in progress and begin a new sequence”. Unlike CAN and SUB, the ESC is not lost: it is the start of whatever comes next.
xterm’s parser table sends ESC to CASE_ESC in the ground state as it does in the middle of a sequence.
Support
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | Yes | §4.2 Control Characters |
| VT510 | manual, 1st ed., 1993 | Yes | Table 4–1 |
| xterm | patch 412, xterm-411a | Yes | |
| libghostty-vt | 0f171f6 | Yes | |
| kitty | 0.49.1, run in a VM | No | fails the 2 cases that show it working |
| foot | 1.28.0, run in a VM | Yes | passes the 2 cases that show it working |
| pyte | 0.8.2, run as a library | No | fails the 2 cases that show it working |
| xterm.js headless | 6.0.0, run as a library | Yes | passes the 2 cases that show it working |
| alacritty_terminal | 0.26.0, run as a library | Yes | passes the 2 cases that show it working |
| rxvt-unicode | 9.31, run in a VM | No | fails the 2 cases that show it working |
| VTE | 0.84.1, run as a library | Yes | passes the 2 cases that show it working |
Validation
ESC-1: Abandons a control sequence, and starts another
A
\e[3 # CUF, unfinished
\e[2;1H # a new CUP
X
|A____|
|X____|
ESC-2: Abandons an escape sequence
\e# # DECALN, unfinished
\e[2;2H
X
|_____|
|_X___|