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

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@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Alexander F. Rødseth 2022-07-22 22:27:05 +02:00 committed by Allan McRae
parent 5abe1455f2
commit 51b2e1c973

View file

@ -165,7 +165,7 @@ static void fill_progress(const int percent, const int proglen)
if(i > hashlen - hash) { if(i > hashlen - hash) {
putchar('-'); putchar('-');
} else if(i == hashlen - hash) { } else if(i == hashlen - hash) {
if(i % 2 == 0) { if(percent % 2 == 0) {
fputs("\033[1;33mC\033[m", stdout); fputs("\033[1;33mC\033[m", stdout);
} else { } else {
fputs("\033[1;33mc\033[m", stdout); fputs("\033[1;33mc\033[m", stdout);