Re: [PATCH 9/9] for-each-ref: support %(...:aligned) for left alignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 19, 2013 at 6:32 PM, Ramkumar Ramachandra
<artagnon@xxxxxxxxx> wrote:
> I don't think [7/9] and [8/9] belong in this series.  Let's see how
> you've used it in :aligned.
>
> Nguyễn Thái Ngọc Duy wrote:
>> diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
>> index 1390da8..3240ca0 100644
>> --- a/builtin/for-each-ref.c
>> +++ b/builtin/for-each-ref.c
>> @@ -1012,8 +1013,26 @@ static void show_refs(struct refinfo **refs, int maxcount,
>>                                 emit(sb + i, cp, sp);
>>                 }
>>                 atom = parse_atom(sp + 2, ep);
>> -               for (i = 0; i < maxcount; i++)
>> +               aligned = !suffixcmp(used_atom[atom], ":aligned");
>> +               for (i = 0, max_length = 0; aligned && i < maxcount; i++) {
>> +                       struct atom_value *v;
>> +                       get_value(refs[i], atom, &v);
>> +                       len = utf8_strnwidth(v->s, -1, 1);
>> +                       if (len > max_length)
>> +                               max_length = len;
>
> Why?!  Why are you denying me the pleasure of using %<, %<|, %>, %>|,
> %>>, %>>|, %<>, and %<>| that you invented in pretty?  The code is
> already there: you just have to hook it up.

Because for-each-ref only understands %(...) not %<|, i.e. % followed
by a (. We need more changes in for-each-ref code to make it accept
%<|, I think. Also %<|(N) needs "N". In case of "branch -v" that
should be calculated automatically, so we need a syntax to say "align
to the left, use the smallest width that fits all". I guess "%<|(*)"?
--
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]