diff --git a/src/chars.c b/src/chars.c index 9e39bf9f4fc9accc998d3070d554f938efdaa8f8..456d18be823feed1f5f6fedbe93f63d5cdb6f9dc 100644 --- a/src/chars.c +++ b/src/chars.c @@ -79,7 +79,6 @@ bool is_alnum_wchar(wchar_t wc) { return iswalnum(wc); } -#endif /* This function is equivalent to isascii(). */ bool is_ascii_char(int c) @@ -92,6 +91,7 @@ bool is_ascii_char(int c) #endif ; } +#endif /* This function is equivalent to isblank(). */ bool is_blank_char(int c) diff --git a/src/nano.c b/src/nano.c index 220c35b14bfb6fdfb9556d08a564a95a3e192421..6cdf7bfe6480a7870670223af95797680a7d4f9b 100644 --- a/src/nano.c +++ b/src/nano.c @@ -3616,11 +3616,15 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool if (allow_funcs) { /* If we got a character, and it isn't a shortcut, toggle, or - * ASCII control character, it's a normal text character. - * Display the warning if we're in view mode, or add the - * character to the input buffer if we're not. */ - if (input != ERR && *s_or_t == FALSE && - (!is_ascii_char(input) || !is_cntrl_char(input))) { + * control character, it's a normal text character. Display the + * warning if we're in view mode, or add the character to the + * input buffer if we're not. */ + if (input != ERR && *s_or_t == FALSE && ( +#ifdef NANO_WIDE + /* Keep non-ASCII control characters in UTF-8 mode. */ + (!ISSET(NO_UTF8) && !is_ascii_char(input)) || +#endif + !is_cntrl_char(input))) { if (ISSET(VIEW_MODE)) print_view_warning(); else { diff --git a/src/winio.c b/src/winio.c index 78ba2f7af7c22831b69482abac4eb8a73a7e7f37..eb656a747dd45def76741d2cf5421f7f1657b1d0 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1677,11 +1677,15 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t, if (allow_funcs) { /* If we got a character, and it isn't a shortcut, toggle, or - * ASCII control character, it's a normal text character. - * Display the warning if we're in view mode, or add the - * character to the input buffer if we're not. */ - if (input != ERR && *s_or_t == FALSE && - (!is_ascii_char(input) || !is_cntrl_char(input))) { + * control character, it's a normal text character. Display the + * warning if we're in view mode, or add the character to the + * input buffer if we're not. */ + if (input != ERR && *s_or_t == FALSE && ( +#ifdef NANO_WIDE + /* Keep non-ASCII control characters in UTF-8 mode. */ + (!ISSET(NO_UTF8) && !is_ascii_char(input)) || +#endif + !is_cntrl_char(input))) { /* If we're using restricted mode, the filename isn't blank, * and we're at the "Write File" prompt, disable text * input. */