Date: Wed, 25 Nov 2015 16:34:17 +0300 From: Andrey Chernov <ache@freebsd.org> To: Baptiste Daroussin <bapt@freebsd.org> Cc: Ed Schouten <ed@nuxi.nl>, Jilles Tjoelker <jilles@stack.nl>, "Sergey V. Dyatko" <sergey.dyatko@gmail.com>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: /bin/ls formatting broken for non-C(?) locales Message-ID: <5655B8D9.8060805@freebsd.org> In-Reply-To: <20151125125325.GB77370@ivaldir.etoilebsd.net> References: <20151120110556.6e20a71f@laptop.minsk.domain> <20151120104253.GA21071@ivaldir.etoilebsd.net> <20151120110212.GB21071@ivaldir.etoilebsd.net> <20151120122352.GA5751@stack.nl> <20151121003541.GF21071@ivaldir.etoilebsd.net> <CABh_MK=cz-zB7krcnKjhqfW9VnwjSmuaZ9%2BAETQiLy3AsHq_vw@mail.gmail.com> <5650DACA.2090501@freebsd.org> <20151125001513.GC70014@ivaldir.etoilebsd.net> <56550F69.8050609@freebsd.org> <20151125125325.GB77370@ivaldir.etoilebsd.net>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --5a6HHSNuFHhw07DPRVifHKtfIA4gI4q4w Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 25.11.2015 15:53, Baptiste Daroussin wrote: > What I did for now is set max_month_width to -1 and in ls_strftime I fa= llback on > the plain strftime meaning you keep localized information but the align= ement is > broken as of now. It will be enough. >> 3) wcwidth/wcswidth may return -1 too, it needs to be checked too. > done and truncate the name of the month to the latest valid character I think there is no point for sofisticated truncating, if locale is not valid. F.e. you may truncate to just 1 char. The thing above will be enough for all such cases. > Review updated (if you prefer a diff by mail just tell me, given you do= not have > a phabricator account.) I don't have phabricator. This one if ((n =3D max_month_width - wab_months_width[i]) > 0) { wcslcat(wab_months[i], L" "/* MAX_ABMON_WIDTH */, max_month_width + 1); } should be if ((n =3D max_month_width - wab_months_width[i]) > 0) wcslcat(wab_months[i], L" "/* MAX_ABMON_WIDTH */, n); I.e. you append n spaces and n is the difference between max and current.= --=20 http://ache.vniz.net/ --5a6HHSNuFHhw07DPRVifHKtfIA4gI4q4w Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJWVbjaAAoJEKUckv0MjfbKP6UH/i3wGDoHi0LaQJaLz0JnIkv7 TqGLSQ0P0CxGMhGh1q9CF6VCklNLubpj5WOUto82afpLUF0aHh7GYYJJHVevKEhT fGpPKOqQn4Hlk9EdlYUbYdBejXMfwT7cM+WUkdRpknM+jnRaqTG4dlyFPLayAjTI L3v1V8TfjVRODJDSaNdDNT5B+78TOiYMd294QXzhCBGLA/U1KLpAvW2lutNyNOma pqt05UPrKc6wyDquz+6I4g+NwUNBt37w7/u+shsJX8cP9BwrkHIDWN4O3xJtebXx 4NazKlo7oIS0ykpxzwuJkRY7jzEsxl8IXvrEYnSlezTU2IjjmJTXSfQgcLutapM= =HiLH -----END PGP SIGNATURE----- --5a6HHSNuFHhw07DPRVifHKtfIA4gI4q4w--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5655B8D9.8060805>