zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit b6e1a100b802188e07fc994d28ea122a6c976169 (tree)
parent 0b5b35c6964ea91133c82adbbd8ab3cf81388b26
Author: Jay Petacat <jay@jayschwa.net>
Date:   Tue, 25 Nov 2025 23:25:27 -0700

std.Progress: Terminate progress escape codes with `ST` not `BEL`

`ST` is the "string terminator" and what is actually prescribed in the
standard for escape codes. Use of `BEL` as a terminator is apparently a
historical oddity that persists for compatibility. Unfortunately, not
all terminals support using `BEL`, including Ubuntu's new default
terminal, Ptyxis. Using `ST` should make it work in more terminals.

Further reading:

- https://en.wikipedia.org/wiki/ANSI_escape_code#Operating_System_Command_sequences
- https://ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf

Diffstat:
Mlib/std/Progress.zig | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/std/Progress.zig b/lib/std/Progress.zig @@ -698,13 +698,13 @@ const save = "\x1b7"; const restore = "\x1b8"; const finish_sync = "\x1b[?2026l"; -const progress_remove = "\x1b]9;4;0\x07"; -const @"progress_normal {d}" = "\x1b]9;4;1;{d}\x07"; -const @"progress_error {d}" = "\x1b]9;4;2;{d}\x07"; -const progress_pulsing = "\x1b]9;4;3\x07"; -const progress_pulsing_error = "\x1b]9;4;2\x07"; -const progress_normal_100 = "\x1b]9;4;1;100\x07"; -const progress_error_100 = "\x1b]9;4;2;100\x07"; +const progress_remove = "\x1b]9;4;0\x1b\\"; +const @"progress_normal {d}" = "\x1b]9;4;1;{d}\x1b\\"; +const @"progress_error {d}" = "\x1b]9;4;2;{d}\x1b\\"; +const progress_pulsing = "\x1b]9;4;3\x1b\\"; +const progress_pulsing_error = "\x1b]9;4;2\x1b\\"; +const progress_normal_100 = "\x1b]9;4;1;100\x1b\\"; +const progress_error_100 = "\x1b]9;4;2;100\x1b\\"; const TreeSymbol = enum { /// ├─