pacman: stop eta timer breaking allignment
When the download estimate is over an hour the format displayed changes from mm:ss to hh:mm:ss. This causes everything to be out of alignment due to the extra characters. So instead lets just go back to --:-- when the download => 100 minutes. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
0699321b3c
commit
abdb4d7fa6
1 changed files with 4 additions and 8 deletions
|
@ -811,12 +811,8 @@ static void draw_pacman_progress_bar(struct pacman_progress_bar *bar)
|
||||||
|
|
||||||
/* 1 space + filenamelen + 1 space + 6 for size + 1 space + 3 for label +
|
/* 1 space + filenamelen + 1 space + 6 for size + 1 space + 3 for label +
|
||||||
* + 2 spaces + 4 for rate + 1 space + 3 for label + 2 for /s + 1 space +
|
* + 2 spaces + 4 for rate + 1 space + 3 for label + 2 for /s + 1 space +
|
||||||
* 8 for eta, gives us the magic 33 */
|
* 5 for eta, gives us the magic 30 */
|
||||||
filenamelen = infolen - 33;
|
filenamelen = infolen - 30;
|
||||||
/* see printf() code, we omit 'HH:' in these conditions */
|
|
||||||
if(eta_h == 0 || eta_h >= 100) {
|
|
||||||
filenamelen += 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* In order to deal with characters from all locales, we have to worry
|
/* In order to deal with characters from all locales, we have to worry
|
||||||
* about wide characters and their column widths. A lot of stuff is
|
* about wide characters and their column widths. A lot of stuff is
|
||||||
|
@ -860,8 +856,8 @@ static void draw_pacman_progress_bar(struct pacman_progress_bar *bar)
|
||||||
}
|
}
|
||||||
if(eta_h == 0) {
|
if(eta_h == 0) {
|
||||||
printf("%02u:%02u", eta_m, eta_s);
|
printf("%02u:%02u", eta_m, eta_s);
|
||||||
} else if(eta_h < 100) {
|
} else if(eta_h == 1 && eta_m < 40) {
|
||||||
printf("%02u:%02u:%02u", eta_h, eta_m, eta_s);
|
printf("%02u:%02u", eta_m + 60, eta_s);
|
||||||
} else {
|
} else {
|
||||||
fputs("--:--", stdout);
|
fputs("--:--", stdout);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue