[PATCH 2/2] pacman: let the progress bar "C"/"c" move up and down at a more regular rate

Alexander F. Rødseth xyproto at archlinux.org
Fri Jul 22 20:27:05 UTC 2022


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 <xyproto at archlinux.org>
---
 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);
-- 
2.37.1



More information about the pacman-dev mailing list