[Top][All Lists]

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

Re: [Nano-devel] the default whitespace indicators

From: Benno Schulenberg
Subject: Re: [Nano-devel] the default whitespace indicators
Date: Sun, 16 Mar 2014 14:22:44 +0100

On Mon, Mar 10, 2014, at 23:04, Mike Frysinger wrote:
> if you look in src/rcfiles.c and look for 'Two single-column characters 
> required', you should be able to use that same logic to detect whether those 
> two chars are OK to use.

I don't think that that logic is good enough for detecting the use of UTF-8 --
there are probably some other encodings that use two bytes per character,
meaning that the bytes that represent "»·" in UTF-8 will likely not produce
"»·" in those other encodings.

But there is a way to properly check for the use of UTF-8, and nano already
does it, thru 'nl_langinfo()', in src/nano.c, line 2144:

        if (locale != NULL && (strcmp(nl_langinfo(CODESET),
                "UTF-8") == 0)) {
#ifdef USE_SLANG

So I've used the result of that to add this to SVN:

+       if (using_utf8()) {
+           whitespace = mallocstrcpy(NULL, "»·");
+           whitespace_len[0] = 2;
+           whitespace_len[1] = 2;
+       } else {

Thanks for the hints.


-- - Access all of your messages and folders
                          wherever you are

reply via email to

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