ST String Terminator
End a control string, such as an operating system command or a device control string.
ST
- ECMA-48
- §8.3.143 ST – String Terminator, p. 70
- DEC STD 070
- §3.5.1.2.5 Universal Terminator, p. 3-19
- VT220
- §2.5.3 Device Control Strings
- VT510
- 4.2 Control Characters
ST closes a control string: one opened by OSC, DCS, or SOS, PM or APC. Everything between the opener and ST is the string’s content, which the terminal reads as a whole rather than printing.
xterm also accepts BEL in place of ST, but only to end an OSC. In any other string it rings the bell and the string goes on (CASE_BELL). libghostty-vt also ends only an OSC with BEL.
DEC STD 070 makes ST a universal terminator: sent on its own, it gets the terminal back to a known state whatever it was in the middle of (§3.5.1.2.5, p. 3-19). Its ESC cancels any escape or control sequence in progress, it ends any control string normally, and with nothing in progress it is ignored. So a program that is not sure what it last left unfinished can send ESC \ and carry on.
ST is a C1 control. ECMA-48 also defines it as the single byte 9C, which a terminal reading UTF-8 does not take as ST: a string opened with ESC ] goes on past it, in a default xterm and in libghostty-vt alike. The UTF-8 page has the details.
Support
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | Yes | §2.5.3 Device Control Strings, as the end of a DCS |
| VT510 | manual, 1st ed., 1993 | Yes | Table 4–2 |
| xterm | patch 412, xterm-411a | Yes | BEL also ends an OSC, and only an OSC |
| libghostty-vt | 0f171f6 | Yes | BEL also ends an OSC, and only an OSC |
| kitty | 0.49.1, run in a VM | Yes | passes the case that shows it working |
| foot | 1.28.0, run in a VM | Yes | passes the case that shows it working |
| pyte | 0.8.2, run as a library | Yes | passes the case that shows it working |
| xterm.js headless | 6.0.0, run as a library | Yes | passes the case that shows it working |
| alacritty_terminal | 0.26.0, run as a library | Yes | passes the case that shows it working |
| ConEmu | build 230724, its documentation | Partly | listed only as the end of an OSC, which may also end with BEL, in ANSI escape codes |
| rxvt-unicode | 9.31, run in a VM | Yes | passes the case that shows it working |
| VTE | 0.84.1, run as a library | Yes | passes the case that shows it working |
Validation
ST-1: Ends an operating system command
\e]2;hello\e\\
X
|X_____|
title "hello"
ST-2: On its own, it is ignored
A
\e\\
B
|AB____|
cursor 1,3
ST-3: It cancels a control sequence in progress
A
\e[2; # an unfinished CUP
\e\\
B
|AB____|
|______|
cursor 1,3
ST-4: The 8-bit form does not end a string
\e]2;hello
\x9c # not valid UTF-8 on its own
X # still part of the command
|______|
title ""