hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 02b76a49cb1f219ac3df1fc13da6c0c71278d752
parent 5e371b0e3b8552ca3ad514e5517172edecdcee51
Author: Sebastian <sebastian@sebsite.pw>
Date:   Thu,  5 Jan 2023 18:07:51 -0500

driver: use terminal escape instead of carriage return

Carriage returns don't play well with some environments. An ANSI escape
code can be used instead here to achieve the same effect.

References: https://todo.sr.ht/~sircmpwn/hare/666
Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mcmd/hare/progress.ha | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmd/hare/progress.ha b/cmd/hare/progress.ha @@ -26,7 +26,7 @@ fn progress_update(plan: *plan) void = { const counter_width = 1 + total_width + 1 + total_width + 3; const progress_width = width - counter_width - 2 - plan.progress.maxwidth; - fmt::fprintf(tty, "\r\x1b[K[{%}/{}] [", + fmt::fprintf(tty, "\x1b[G\x1b[K[{%}/{}] [", complete, &fmt::modifiers { width = total_width: uint, ... @@ -55,7 +55,7 @@ fn progress_clear(plan: *plan) void = { case => return; }; - fmt::fprint(tty, "\r\x1b[K")!; + fmt::fprint(tty, "\x1b[G\x1b[K")!; }; fn progress_increment(plan: *plan) void = {