[Top][All Lists]

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

Re: [Nano-devel] Comment/Uncomment feature patch

From: Mike Scalora
Subject: Re: [Nano-devel] Comment/Uncomment feature patch
Date: Sat, 21 May 2016 10:07:59 -0600

On Sat, May 21, 2016 at 3:21 AM, Benno Schulenberg
<address@hidden> wrote:
> > is_blank_mbchar
> ...
> The first one, yes.  And you can't just s++ through a string;
> you need to use move_mbright().
> (Strangely, is_blank_mbchar() doesn't consider \r to be blank, so
> when editing an unconverted DOS file, a line that is factually
> empty isn't considered as such.)
> Benno

Does nano support multibyte encoding other than UTF-8? I see all the C
library mb functions wrapped in #ifdef UTF8 which leads me to thing we
only support UTF-8 or the flag is a bad name for multibyte.

Is this "permitted"?

    if (is_blank_mbchar(s+p) || (mblen(s+p, MB_CUR_MAX) == 1 && s[p] == '\r'))

Otherwise I think the following is more "multibyte clean". If we only
support UTF-8 mb, I think the simpler code above works but maybe
doesn't follow the mb dogma to support non-UTF-8 mb encoding locals.

#ifdef ENABLE_UTF8
    wchar_t c;
    if (is_blank_mbchar(s+p) || (mbstowcs(&c, s+p, MB_CUR_MAX) > 0 &&
c == L'\r'))
    if (isblank(s+p) || s[p] == '\r'))


reply via email to

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