Web lists-archives.com

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




On Fri, Feb 1, 2019 at 2:42 PM Johannes Schindelin
<Johannes.Schindelin@xxxxxx> wrote:
> > 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