coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] ls: use right-aligned abbreviated month names


From: Pádraig Brady
Subject: Re: [PATCH] ls: use right-aligned abbreviated month names
Date: Sat, 16 Feb 2019 20:51:41 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 15/02/19 10:03, Lion Yang wrote:
> * src/ls.c: Use right-alignment for the list of months
> to make it more visually aligned. Locales which have names
> with fixed lengths will not be affected.
> ---
>   src/ls.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ls.c b/src/ls.c
> index 243c186..e73e29a 100644
> --- a/src/ls.c
> +++ b/src/ls.c
> @@ -1132,7 +1132,7 @@ abmon_init (char abmon[12][ABFORMAT_SIZE])
>             if (strchr (abbr, '%'))
>               return false;
>             size_t req = mbsalign (abbr, abmon[i], ABFORMAT_SIZE,
> -                                 &width, MBS_ALIGN_LEFT, 0);
> +                                 &width, MBS_ALIGN_RIGHT, 0);
>             if (! (req < ABFORMAT_SIZE))
>               return false;
>             required_mon_width = MAX (required_mon_width, width);
> 

One generally wants to align text left and numbers right.
So I don't think this would be an appropriate default.
Though I see in some locales that numbers are used for months.
I also see that the abbreviations can include alignment.
(which is generally the wrong place to do that, but still we have to cater for 
it).

So in summary numeric zh_CN is misaligned, while ja_JP is aligned
(as it has the alignment included). Now our alignment code handles
existing padding and so your change will work for all locates
where the abmons starting with a number.

So we should adjust the patch to select the alignment based on that.

thanks!
Pádraig





reply via email to

[Prev in Thread] Current Thread [Next in Thread]