From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Lirzin Subject: Re: [PATCH] download: Fix some minor progress-logging regressions. Date: Thu, 17 Sep 2015 23:44:38 +0200 Message-ID: <87r3lwhgah.fsf@openmailbox.org> References: <87bnd0j4dy.fsf@openmailbox.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcgzO-0003xb-4S for guix-devel@gnu.org; Thu, 17 Sep 2015 17:45:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcgzK-0003P0-Vt for guix-devel@gnu.org; Thu, 17 Sep 2015 17:45:10 -0400 Received: from smtp1.openmailbox.org ([62.4.1.35]:45408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcgzK-0003Kx-Qe for guix-devel@gnu.org; Thu, 17 Sep 2015 17:45:06 -0400 In-Reply-To: (Steve Sprang's message of "Thu, 17 Sep 2015 13:52:55 -0700") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Steve Sprang Cc: guix-devel@gnu.org Steve Sprang 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