git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] help: align the longest command in the command listing

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 1, 2019, 08:24 UTC
Message-ID
<CACsJy8B=7NsnnoSH1Bt_C-Nop95ky=rudHU3SOVERVudDD7Tfw@mail.gmail.com>
In-Reply-To
<nycvar.QRO.7.76.6.1902010842010.41@tvgsbejvaqbjf.bet>

On Fri, Feb 1, 2019 at 2:42 PM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 13 quoted lines
> > diff --git a/help.c b/help.c
> > index ff05fd22df..520c9080e8 100644
> > --- a/help.c
> > +++ b/help.c
> > @@ -85,7 +85,8 @@ static void print_command_list(const struct cmdname_help *cmds,
> >               if (cmds[i].category & mask) {
> >                       size_t len = strlen(cmds[i].name);
> >                       printf("   %s   ", cmds[i].name);
> > -                     mput_char(' ', longest > len ? longest - len : 1);
> > +                     if (longest > len)
> > +                             mput_char(' ', longest - len);
>
> Why not simply replace the `1` by `0`?

While it makes the diff shorter, I think it's a bit more confusing (why add zero spaces?)

-- 
Duy
Previous: Johannes Schindelin
Message 3 of 3 in “help: align the longest command in the command listing”
  1. help: align the longest command in the command listingNguyễn Thái Ngọc Duy, Jan 31, 2019
  2. Johannes SchindelinFeb 1, 2019
  3. Duy NguyenFeb 1, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.