Commit 446972b4 authored by Sefa Eyeoglu's avatar Sefa Eyeoglu Committed by Allan McRae
Browse files

pacman: simplify chomp mouth logic


Signed-off-by: Allan McRae's avatarAllan McRae <allan@archlinux.org>
parent e654aa8a
Pipeline #14262 passed with stage
in 1 minute and 41 seconds
......@@ -156,13 +156,8 @@ static void fill_progress(const int bar_percent, const int disp_percent,
/* 8 = 1 space + 1 [ + 1 ] + 5 for percent */
const int hashlen = proglen > 8 ? proglen - 8 : 0;
const int hash = bar_percent * hashlen / 100;
static int lasthash = 0;
int i;
if(bar_percent == 0) {
lasthash = 0;
}
if(hashlen > 0) {
fputs(" [", stdout);
for(i = hashlen; i > 0; --i) {
......@@ -171,19 +166,10 @@ static void fill_progress(const int bar_percent, const int disp_percent,
if(i > hashlen - hash) {
putchar('-');
} else if(i == hashlen - hash) {
if(lasthash == hash) {
if(i % 2 == 0) {
fputs("\033[1;33mC\033[m", stdout);
} else {
fputs("\033[1;33mc\033[m", stdout);
}
if(i % 2 == 0) {
fputs("\033[1;33mC\033[m", stdout);
} else {
lasthash = hash;
if(i % 2 == 0) {
fputs("\033[1;33mC\033[m", stdout);
} else {
fputs("\033[1;33mc\033[m", stdout);
}
fputs("\033[1;33mc\033[m", stdout);
}
} else if(i % 3 == 0) {
fputs("\033[0;37mo\033[m", stdout);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment