bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] broken progressbar in 1.16


From: Giuseppe Scrivano
Subject: Re: [Bug-wget] broken progressbar in 1.16
Date: Sat, 01 Nov 2014 18:51:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Darshit Shah <address@hidden> writes:

> From 1a29f21bb24c531f450dd59446a0c5a0f7e81110 Mon Sep 17 00:00:00 2001
> From: Darshit Shah <address@hidden>
> Date: Sat, 1 Nov 2014 05:34:04 +0530
> Subject: [PATCH] Remove extra padding from the progress bar
>
> ---
>  src/ChangeLog  | 7 +++++++
>  src/progress.c | 7 ++-----
>  2 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/src/ChangeLog b/src/ChangeLog
> index 58bf905..214441f 100644
> --- a/src/ChangeLog
> +++ b/src/ChangeLog
> @@ -1,3 +1,10 @@
> +2014-11-01  Darshit Shah  <address@hidden>
> +
> +     * 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-10-29  Peter Meiser <address@hidden> (tiny change)
>  
>       * openssl.c (ssl_init) [! OPENSSL_NO_SSL3]: Add guard for OpenSSL
> diff --git a/src/progress.c b/src/progress.c
> index 5ba542d..f211998 100644
> --- a/src/progress.c
> +++ b/src/progress.c
> @@ -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

ACK with a whitespace after "count_cols".

Regards,
Giuseppe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]