all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Julien Lepiller <julien@lepiller.eu>
Cc: Ricardo Wurmus <rekado@elephly.net>, 65546@debbugs.gnu.org
Subject: [bug#65546] [PATCH v2] guix: Properly compute progress bar width.
Date: Wed, 11 Oct 2023 23:00:07 +0200	[thread overview]
Message-ID: <8734ygswmg.fsf@gnu.org> (raw)
In-Reply-To: <20230909172047.6254-1-julien@lepiller.eu> (Julien Lepiller's message of "Sat, 9 Sep 2023 19:20:42 +0200")

Hi Julien,

Julien Lepiller <julien@lepiller.eu> skribis:

> * guix/build/syscalls.scm (terminal-width): New procedure.
> * guix/progress.scm (progress-reporter/bar): Use it to compute progress
> bar width.
> * guix/git.scm (show-progress): Use it to compute progress bar width.
> * tests/syscalls.scm: Add tests.

Others have already said “LGTM”, and I concur.  I’ll still make a couple
of minor suggestions but that shoudln’t stop you from going ahead
(everyone’s waiting for it :-)).

> +(define get-wchar-ffi
> +  (pointer->procedure int
> +                      (dynamic-func "mbstowcs" (dynamic-link))
> +                      (list '* '* size_t)))
> +(define terminal-string-width-ffi
> +  (pointer->procedure int
> +                      (dynamic-func "wcswidth" (dynamic-link))
> +                      (list '* size_t)))
> +
> +(define (terminal-string-width str)
> +  "Return the width of a string as it would be printed on the terminal.  This
> +procedure accounts for characters that have a different width than 1, such as
> +CJK double-width characters."

I’d suggest following the style of the rest of the file, which is to do
something like:

(define terminal-string-width
  (let ((mbstowcs (syscall->procedure …))
        (wcswidth (syscall->procedure …)))
    (lambda (str)
      …)))

Ideally the syscalls.scm changes would be in a commit separate from the
progress.scm changes.

Now we have the problem that OpenJDK unfortunately depends on (guix
build syscalls), which makes this change half-of-the-world-rebuild.
There’s another pending syscalls.scm change:

  https://issues.guix.gnu.org/66055
  https://issues.guix.gnu.org/66054

Time to create a branch?

Ludo’.




  reply	other threads:[~2023-10-11 21:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-26  6:36 [bug#65546] [PATCH] guix: Properly compute progress bar width Julien Lepiller
2023-09-09 13:48 ` Ludovic Courtès
2023-09-09 17:20 ` [bug#65546] [PATCH v2] " Julien Lepiller
2023-10-11 21:00   ` Ludovic Courtès [this message]
2023-11-11 10:11     ` bug#65546: " Julien Lepiller
2023-09-26  8:40 ` [bug#65546] [PATCH] " Ricardo Wurmus
2023-09-27  4:02 ` [bug#65546] I have this page bookmarked chris
2023-10-11 20:04 ` [bug#65546] please apply this patch :) chris
2023-10-29  3:50 ` [bug#65546] [PATCH] guix: Properly compute progress bar width chris
2023-11-09 10:54   ` chris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8734ygswmg.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=65546@debbugs.gnu.org \
    --cc=julien@lepiller.eu \
    --cc=rekado@elephly.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.