Re: [hackers] [st][patch] replace utf8strchr with wcschr
Hi,
On Wed, Mar 13, 2019 at 08:35:09PM +0100, Hiltjo Posthuma wrote:
> I don't like mixing of the existing functions with wchar_t.
> I think st should (at the very least internally) use utf-8.
What about having an array of Rune to store worddelimiters and have a
simple search function such as:
Rune *
utf8strchr(Rune *s, Rune u)
{
for (; *s; s++)
if (*s == u)
return s;
return NULL;
}
The worddelimiters definition will become:
Rune worddelimiters[] = { ' ', 0 };
Which will allow adding unicode codepoint from wide char literal.
Even if the wchar_t is 16 bits wide the constant will be stored
into a Rune, which I belive is a 32 bits constant, and should work
fine.
my 2cc
Cheers,
Jules
Received on Thu Mar 14 2019 - 11:17:28 CET
This archive was generated by hypermail 2.3.0
: Thu Mar 14 2019 - 11:24:22 CET