^[control-codes
live in libghostty-vt

Escape sequences

ST String Terminator

View as Markdown

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

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Yes§2.5.3 Device Control Strings, as the end of a DCS
VT510manual, 1st ed., 1993YesTable 4–2
xtermpatch 412, xterm-411aYesBEL also ends an OSC, and only an OSC
libghostty-vt0f171f6YesBEL also ends an OSC, and only an OSC
kitty0.49.1, run in a VMYespasses the case that shows it working
foot1.28.0, run in a VMYespasses the case that shows it working
pyte0.8.2, run as a libraryYespasses the case that shows it working
xterm.js headless6.0.0, run as a libraryYespasses the case that shows it working
alacritty_terminal0.26.0, run as a libraryYespasses the case that shows it working
ConEmubuild 230724, its documentationPartlylisted only as the end of an OSC, which may also end with BEL, in ANSI escape codes
rxvt-unicode9.31, run in a VMYespasses the case that shows it working
VTE0.84.1, run as a libraryYespasses 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 ""
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.