diff --git a/src/nano.c b/src/nano.c index 6cdf7bfe6480a7870670223af95797680a7d4f9b..9f57210e76c2aaf831a732b7ed1351ce257b0710 100644 --- a/src/nano.c +++ b/src/nano.c @@ -3621,7 +3621,9 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool * 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. */ + /* Keep non-ASCII control characters if we're in UTF-8 + * mode, since they might be part of a UTF-8 + * sequence. */ (!ISSET(NO_UTF8) && !is_ascii_char(input)) || #endif !is_cntrl_char(input))) { @@ -3949,8 +3951,8 @@ int main(int argc, char **argv) #ifdef NANO_WIDE { /* If the locale set doesn't exist, or it exists but doesn't - * include the string "UTF-8", we shouldn't use UTF-8 - * support. */ + * include the string "UTF-8", we shouldn't go into UTF-8 + * mode. */ char *locale = setlocale(LC_ALL, ""); if (locale == NULL || (locale != NULL && diff --git a/src/winio.c b/src/winio.c index eb656a747dd45def76741d2cf5421f7f1657b1d0..d8a9cbe0490140e1d6e748325b4690ff1e318f1e 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1682,7 +1682,9 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t, * 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. */ + /* Keep non-ASCII control characters if we're in UTF-8 + * mode, since they might be part of a UTF-8 + * sequence. */ (!ISSET(NO_UTF8) && !is_ascii_char(input)) || #endif !is_cntrl_char(input))) {