[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 1/4] Fix width computation
From: |
Bruno Haible |
Subject: |
Re: [PATCH v3 1/4] Fix width computation |
Date: |
Thu, 06 Jan 2022 00:19:29 +0100 |
Robbie Harwood wrote:
> From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
>
> [rharwood@redhat.com: merge with later fix from pjones@redhat.com]
> Signed-off-by: Robbie Harwood <rharwood@redhat.com>
> ---
> lib/argp-fmtstream.c | 80 +++++++++++++++++++++++++++++++++++++-------
> lib/argp-help.c | 3 +-
> lib/mbswidth.c | 15 +++++++++
> lib/mbswidth.h | 4 +++
> 4 files changed, 88 insertions(+), 14 deletions(-)
This patch will need several more iterations, as it mixes two good
ideas, with - so far - imperfect implementations:
* The need to use wcwidth in argp-fmtstream arises because the
help strings are internationalized. But for internationalized strings,
line breaking by looking for spaces is just wrong. (It works for
Russian and Greek but not for Chinese.) A much better algorithm
(that works for most languages, except Thai) is found in
GNU libunistring 1.0. But the code in glibc cannot use libunistring;
so there likely will need to be some '#ifdef _LIBC'.
* The idea to parse escape sequences in a special way, before invoking
wcwidth, it nice. But's it's far from complete. IMO one needs to look
at GNU teseq, the ISO 2022 standard, and other de-facto standards
when implementing that. And it should then be implemented in wcswidth,
mbswidth, etc. uniformly.
Bruno