^[control-codes live in libghostty-vt

C0 control characters

BEL Bell

Ring the terminal's bell.

BEL
ECMA-48
§8.3.3 BEL – Bell, p. 33
DEC STD 070
§5.7 Warning Bell, p. 5-114
VT510
4.2 Control Characters

Ring the bell: get the attention of the person at the terminal. DEC STD 070 asks for a warning “bell”, “or some similar audible indicator”, whose volume the user may be able to change or turn off. libghostty-vt only reports the bell to its host, which decides what to do. Nothing on the screen changes, and the cursor does not move.

BEL has a second job: it ends an operating system command, such as setting the window title, in place of the string terminator ESC \. There it is part of the command, and does not ring.

A control character sent in the middle of a control sequence is carried out as if it had come just before the sequence, and the sequence then carries on; DEC STD 070 gives control characters precedence over every kind of sequence (§3.5.1.1, p. 3-18). It also warns that ANSI and ISO standards treat this as an error, so a program should not rely on it.

Validation

BEL-1: Rings, and moves nothing

AB
\a
C
|ABC__|
cursor 1,4
bell 1

BEL-2: Once for each

\a\a\a
|_____|
bell 3

BEL-3: Ending a command does not ring

\e]2;hello\a
|_____|
title "hello"
bell 0

BEL-4: In the middle of a control sequence

\e[2\a;3H # BEL inside CUP
|_____|
|_____|
cursor 2,3
bell 1
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.