From: "Wang Bing-hua" <louiswpf@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: <git@vger.kernel.org>
Subject: Re: [PATCH v2] remote: align --verbose output with spaces
Date: Thu, 19 Dec 2024 02:14:30 +0000 [thread overview]
Message-ID: <1812724a6e98b9f0.772d5fa147f10a1c.6ab8f72f53fdfcab@host> (raw)
In-Reply-To: <xmqqy10dt2zb.fsf@gitster.g>
On 18/12/2024 07:39, Junio C Hamano wrote:
> Ah, of course, I should have double-checked, but it should be more
> like
>
> printf("%.*s%s%s",
> maxwidth + 1 - utf8_strwidth(item->string), "",
> item->string,
> item->util ? item->util : "");
>
> meaning
>
> (1) the first output field must have maxwidth+1 - the display width
> the second output field takes. The field's contents is empty, so
> we get enough SP padded to make the total of this first field
> and the second field to make maxwidth+1.
>
> (2) the second output field is item->string itself.
>
> (3) the third output field has item->util if exists.
Understood. Thanks for the explanation.
Here is a tested code snippet for the record:
printf("%s%*s %s\n",
item->string,
maxwidth - utf8_strwidth(item->string), "",
item->util ? (const char *)item->util : "");
> You already know from my initial reaction what my answer would be,
> but I am inclined to hear from others before we make a decision.
I see. Thanks.
prev parent reply other threads:[~2024-12-19 2:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 12:39 [PATCH] remote: align --verbose output with spaces Wang Bing-hua via GitGitGadget
2024-12-17 13:23 ` shejialuo
2024-12-17 15:24 ` Wang Bing-hua
2024-12-17 20:21 ` Junio C Hamano
2024-12-18 5:49 ` Wang Bing-hua
2024-12-18 13:52 ` shejialuo
2024-12-18 14:09 ` Wang Bing-hua
2024-12-17 17:18 ` [PATCH v2] " Wang Bing-hua via GitGitGadget
2024-12-17 20:47 ` Junio C Hamano
2024-12-18 8:37 ` Wang Bing-hua
2024-12-18 15:39 ` Junio C Hamano
2024-12-19 2:14 ` Wang Bing-hua [this message]
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=1812724a6e98b9f0.772d5fa147f10a1c.6ab8f72f53fdfcab@host \
--to=louiswpf@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox