zig

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

commit 8ebb18d9da0bfbe6a974636fd36e3391d1de253b (tree)
parent b83ef595a53377189d42bdb697af866f30838040
Author: LemonBoy <thatlemon@gmail.com>
Date:   Sat, 13 Mar 2021 00:42:42 +0100

std: Use more common escape sequences in Progress

This should fix the badly-rendered progress message when run in
Terminal.app.

Diffstat:
Mlib/std/Progress.zig | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/std/Progress.zig b/lib/std/Progress.zig @@ -185,9 +185,11 @@ pub fn refresh(self: *Progress) void { // ED -- Clear screen const ED = "\x1b[J"; // DECSC -- Save cursor position -const DECSC = "\x1b[s"; +const DECSC = "\x1b7"; // DECRC -- Restore cursor position -const DECRC = "\x1b[u"; +const DECRC = "\x1b8"; +// Note that ESC7/ESC8 are used instead of CSI s/CSI u as the latter are not +// supported by some terminals (eg. Terminal.app). fn refreshWithHeldLock(self: *Progress) void { const is_dumb = !self.supports_ansi_escape_codes and !(std.builtin.os.tag == .windows);