toggle_init(), usage(), do_tab(), main(), nanorc.sample,
nano.1, nanorc.5, and nano.texi. (DLR, suggested by many
people)
+ - Change the NO_UTF8 flag to the USE_UTF8 flag, and reverse its
+ meaning. (DLR)
- chars.c:
make_mbstring()
- Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a
assert(c != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
assert(c != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
assert(c != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
assert(c != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
assert(c != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), crep_mb_len;
assert(c != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
wchar_t wc;
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX), width;
{
return
#ifdef NANO_WIDE
- !ISSET(NO_UTF8) ? MB_CUR_MAX :
+ ISSET(USE_UTF8) ? MB_CUR_MAX :
#endif
1;
}
assert(chr_mb_len != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
chr_mb = charalloc(MB_CUR_MAX);
*chr_mb_len = wctomb(chr_mb, chr);
*bad_chr = FALSE;
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
/* Get the number of bytes in the multibyte character. */
buf_mb_len = mblen(buf, MB_CUR_MAX);
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
{
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
char *s1_mb = charalloc(MB_CUR_MAX);
char *s2_mb = charalloc(MB_CUR_MAX);
wchar_t ws1, ws2;
const char *mbstrcasestr(const char *haystack, const char *needle)
{
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
char *r_mb = charalloc(MB_CUR_MAX);
char *q_mb = charalloc(MB_CUR_MAX);
wchar_t wr, wq;
const char *rev_start)
{
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
char *r_mb = charalloc(MB_CUR_MAX);
char *q_mb = charalloc(MB_CUR_MAX);
wchar_t wr, wq;
assert(s != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
size_t n = 0;
int s_mb_len;
assert(str != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
char *chr_mb = charalloc(MB_CUR_MAX);
bool retval = FALSE;
assert(s != NULL && c != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
char *s_mb = charalloc(MB_CUR_MAX);
const char *q = s;
wchar_t ws, wc;
return
#ifdef NANO_WIDE
- !ISSET(NO_UTF8) ?
+ ISSET(USE_UTF8) ?
(mbstowcs(NULL, s, (size_t)-1) != (size_t)-1) :
#endif
assert(s != NULL);
#ifdef NANO_WIDE
- if (!ISSET(NO_UTF8)) {
+ if (ISSET(USE_UTF8)) {
char *chr_mb = charalloc(MB_CUR_MAX);
char *s_mb = charalloc((MB_CUR_MAX * strlen(s)) + 1);
size_t s_mb_len = 0;
#ifdef NANO_WIDE
{
- /* If the locale set doesn't exist, or it exists but doesn't
- * include the case-insensitive string "UTF8" or "UTF-8", we
- * shouldn't go into UTF-8 mode. */
+ /* If the locale set exists and includes the case-insensitive
+ * string "UTF8" or "UTF-8", we should use UTF-8. */
char *locale = setlocale(LC_ALL, "");
- if (locale == NULL || (locale != NULL &&
- strcasestr(locale, "UTF8") == NULL &&
- strcasestr(locale, "UTF-8") == NULL))
- SET(NO_UTF8);
-
+ if (locale != NULL && (strcasestr(locale, "UTF8") != NULL ||
+ strcasestr(locale, "UTF-8") != NULL)) {
+ SET(USE_UTF8);
#ifdef USE_SLANG
- if (!ISSET(NO_UTF8))
SLutf8_enable(TRUE);
#endif
+ }
}
#else
setlocale(LC_ALL, "");
#define WHITESPACE_DISPLAY (1<<27)
#define MORE_SPACE (1<<28)
#define TABS_TO_SPACES (1<<29)
-#define NO_UTF8 (1<<30)
+#define USE_UTF8 (1<<30)
/* Control key sequences. Changing these would be very, very bad. */
#define NANO_CONTROL_SPACE 0
}
}
#ifdef NANO_WIDE
- else if (!ISSET(NO_UTF8) && mbwidth(buf_mb) > 1) {
+ else if (ISSET(USE_UTF8) && mbwidth(buf_mb) > 1) {
converted[index++] = ' ';
start_col++;
/* If buf contains an invalid multibyte non-control
* character, interpret that character as though it's a
* normal non-control character. */
- if (!ISSET(NO_UTF8) && bad_char) {
+ if (ISSET(USE_UTF8) && bad_char) {
char *bad_buf_mb;
int bad_buf_mb_len;