From: Kirill Kolyshkin <kolyshkin@gmail.com>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: git@vger.kernel.org, Roman Dodin <dodin.roman@gmail.com>
Subject: Re: [PATCH] remote: align columns on -v
Date: Wed, 8 Feb 2023 17:02:00 -0800 [thread overview]
Message-ID: <CAGmPdrzpEvjCh8u4-FjsaE3tmqfiE3xyytO-++56JrjcMEgP=A@mail.gmail.com> (raw)
In-Reply-To: <20230208161222.guqqwlceqiy3jq7e@tb-raspi4>
On Wed, Feb 8, 2023 at 8:12 AM Torsten Bögershausen <tboegi@web.de> wrote:
>
> On Tue, Feb 07, 2023 at 03:52:38PM -0800, Kir Kolyshkin wrote:
> > Currently, git remote -v produces a misaligned output when a remote name
> > is more than 8 characters long (i.e. longer than a tab step). Here's how
> > it looks like:
> >
> > giuseppe https://github.com/giuseppe/runc (fetch)
> > giuseppe https://github.com/giuseppe/runc (push)
> > kir git@github.com:kolyshkin/runc.git (fetch)
> > kir git@github.com:kolyshkin/runc.git (push)
> > lifubang https://github.com/lifubang/runc (fetch)
> > lifubang https://github.com/lifubang/runc (push)
> > marquiz https://github.com/marquiz/runc (fetch)
> > marquiz https://github.com/marquiz/runc (push)
> >
> > Let's find the maximum width and use it for alignment.
> >
> > While at it, let's keep the \t in case some tools depend on it
> > for parsing (there will still be trailing spaces in the remote name).
> >
> > With this change, the output is like this now:
> >
> > giuseppe https://github.com/giuseppe/runc (fetch)
> > giuseppe https://github.com/giuseppe/runc (push)
> > kir git@github.com:kolyshkin/runc.git (fetch)
> > kir git@github.com:kolyshkin/runc.git (push)
> > lifubang https://github.com/lifubang/runc (fetch)
> > lifubang https://github.com/lifubang/runc (push)
> > marquiz https://github.com/marquiz/runc (fetch)
> > marquiz https://github.com/marquiz/runc (push)
> >
>
> Thanks for working on that - I had the same wish as well.
> However, I am tempted to comment on some details here.
> Especially, what happens if a remote is named with a non-ASCII
> character (unicode code point would be a better term) ?
> To determine the width on screen for aligment, strlen()
> does the wrong thing here.
> This has been done at other place (being UTF-8 aware),
> you may want to have a look at this change:
>
> commit 12fc4ad89e23af642a8614371ff80bc67cb3315d
> Author: Torsten Bögershausen <tboegi@web.de>
> Date: Wed Sep 14 17:13:33 2022 +0200
>
> diff.c: use utf8_strwidth() to count display width
Yes, I have seen now that neither strlen nor printf with the specified width
do a good job with unicode. Thank you for pointing this out, I'll send v2 soon.
next prev parent reply other threads:[~2023-02-09 1:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 23:52 [PATCH] remote: align columns on -v Kir Kolyshkin
2023-02-08 16:12 ` Torsten Bögershausen
2023-02-08 16:32 ` Junio C Hamano
2023-02-09 1:02 ` Kirill Kolyshkin [this message]
2023-02-08 16:19 ` Junio C Hamano
2023-02-09 1:11 ` Kirill Kolyshkin
2023-02-09 1:12 ` Kir Kolyshkin
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGmPdrzpEvjCh8u4-FjsaE3tmqfiE3xyytO-++56JrjcMEgP=A@mail.gmail.com' \
--to=kolyshkin@gmail.com \
--cc=dodin.roman@gmail.com \
--cc=git@vger.kernel.org \
--cc=tboegi@web.de \
/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 public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).