guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] download: Fix some minor progress-logging regressions.


From: Mathieu Lirzin
Subject: Re: [PATCH] download: Fix some minor progress-logging regressions.
Date: Thu, 17 Sep 2015 23:44:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Steve Sprang <address@hidden> writes:

> Here's attempt #2.
[...]
> @@ -101,15 +101,14 @@ width of the bar is BAR-WIDTH."
>  
>  (define (string-pad-middle left right len)
>    "Combine LEFT and RIGHT with enough padding in the middle so that the
> -resulting string has length at least LEN.  This right justifies RIGHT."
> -  (string-append left
> -                 (string-pad right (max 0 (- len (string-length left))))))
> -
> -(define (store-url-abbreviation url)
> -  "Return a friendlier version of URL for display."
> -  (let ((store-path (string-append (%store-directory) "/" (basename url))))
> -    ;; Take advantage of the implementation for store paths.
> -    (store-path-abbreviation store-path)))
> +resulting string has length at least LEN (it may overflow).  If the string
> +does not overflow, the last char in RIGHT will be flush with the LEN
> +column."
> +  (let* ((total-used (+ (string-length left)
> +                        (string-length right)))
> +         (num-spaces (max 1 (- len total-used)))
> +         (padding    (make-string num-spaces #\space)))
> +    (string-append left padding right)))

The phrasing is fine for me.  Thanks again.

--
Mathieu Lirzin



reply via email to

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