[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: argp --help formatting bug with non-ASCII characters
From: |
Collin Funk |
Subject: |
Re: argp --help formatting bug with non-ASCII characters |
Date: |
Fri, 12 Apr 2024 09:09:58 -0700 |
User-agent: |
Mozilla Thunderbird |
Hi Bruno,
On 4/11/24 4:23 PM, Bruno Haible wrote:
> The bug is apparently that in argp-fmtstream.c, a character such as Ä or É
> augments fs->point_col by 2, when it should only augment it by 1.
>
> In other words, it should use the Gnulib module 'mbswidth'.
>
> Any volunteers?
I am very unfamiliar with these modules, so I would appreciate this
being double checked.
This patch fixes the two examples that you gave. I think it may be
missing the case where the buffer doesn't end in a partial line
though.
Here is the variable I add to adjust the columns:
len = fs->p - buf;
+ visible_len = mbsnwidth (buf, len, 0);
nl = memchr (buf, '\n', len);
After checking that nl != NULL, would I need to do:
visible_len = mbsnwidth (buf, nl - buf, 0);
I have a feeling it is necessary, but I don't have a test case to make
sure I don't break things.
Collin
0001-argp-Fix-alignment-of-option-doc-strings.patch
Description: Text Data