Remove extra padding from the progress bar

This commit is contained in:
Darshit Shah 2014-11-01 05:34:04 +05:30
parent 8078adee7f
commit 35bfcb34b0
2 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2014-11-01 Darshit Shah <darnir@gmail.com>
* progress.c (create_image): Extra padding for size_grouped_diff has already
been added. Do not add that again.
(create_image): Assert that the progress bar being drawn is lesser than the
size of the screen.
2014-11-01 Giuseppe Scrivano <gscrivan@redhat.com>
* http.c (gethttp): Do not check for "Connection: close" header

View File

@ -907,10 +907,6 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
char *p = bp->buffer;
wgint size = bp->initial_length + bp->count;
const char *size_grouped = with_thousand_seps (size);
int size_grouped_len = count_cols (size_grouped);
/* Difference between num cols and num bytes: */
int size_grouped_diff = strlen (size_grouped) - size_grouped_len;
int size_grouped_pad; /* Used to pad the field width for size_grouped. */
struct bar_progress_hist *hist = &bp->hist;
@ -1159,9 +1155,10 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
move_to_end (p);
}
while (p - bp->buffer - bytes_cols_diff - size_grouped_diff < bp->width)
while (p - bp->buffer - bytes_cols_diff < bp->width)
*p++ = ' ';
*p = '\0';
assert (count_cols (bp->buffer) <= bp->width);
}
/* Print the contents of the buffer as a one-line ASCII "image" so