nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 40ea2a2ea085bef9732252dccc9f6861b0ce6bb8
parent 496488c5d21d68fd51978c256f963dc74535513b
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Wed, 16 Mar 2005 16:32:33 +0000

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

Diffstat:
Msrc/chars.c | 2+-
Msrc/nano.c | 14+++++++++-----
Msrc/winio.c | 14+++++++++-----
3 files changed, 19 insertions(+), 11 deletions(-)

diff --git 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 @@ -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 @@ -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. */