From 51b2e1c973e3466471a1762716e96cf502817c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20F=2E=20R=C3=B8dseth?= Date: Fri, 22 Jul 2022 22:27:05 +0200 Subject: [PATCH] pacman: let the progress bar "C"/"c" move up and down at a more regular rate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For some terminal widths, the "C"/"c" character does not alternate at regular intervals, but may look like it is stuck at either lowercase or uppercase. The previous behavior toggled based on the character position, while this new behavior toggles the chomp alternation based on the progress percentage value. This leads to slightly improved chomping. Signed-off-by: Alexander F. Rødseth Signed-off-by: Allan McRae --- src/pacman/callback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pacman/callback.c b/src/pacman/callback.c index df4032a4..aa6303bf 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -165,7 +165,7 @@ static void fill_progress(const int percent, const int proglen) if(i > hashlen - hash) { putchar('-'); } else if(i == hashlen - hash) { - if(i % 2 == 0) { + if(percent % 2 == 0) { fputs("\033[1;33mC\033[m", stdout); } else { fputs("\033[1;33mc\033[m", stdout);