From 6a848dc26eb97a74ce01694d066dcb6eab335aa3 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Tue, 28 Feb 2023 20:30:40 +0100 Subject: [PATCH 06/N] fill_progress --- src/pacman/callback.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 75c74f8..2f07512 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -153,8 +153,11 @@ static int64_t get_update_timediff(int first_call) static void fill_progress(const int bar_percent, const int disp_percent, const int proglen) { - /* 8 = 1 space + 1 [ + 1 ] + 5 for percent */ - const int hashlen = proglen > 8 ? proglen - 8 : 0; + /* 9 = 1 space + 1 [ + 1 ] + 5 for percent + 1 blank */ + /* Without the single blank at the end, carriage return wouldn't + * work properly on most windows terminals. + */ + const int hashlen = proglen > 9 ? proglen - 9 : 0; const int hash = bar_percent * hashlen / 100; static int lasthash = 0, mouth = 0; int i;