Commit 40ea2a2e authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

actually, we can swallow non-ASCII control characters if we're not in

UTF-8 mode


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2379 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 19 additions and 11 deletions
+19 -11
......@@ -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)
......
......@@ -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 {
......
......@@ -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. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment