mirror of git://git.sv.gnu.org/nano.git
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
This commit is contained in:
parent
496488c5d2
commit
40ea2a2ea0
|
@ -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)
|
||||
|
|
14
src/nano.c
14
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 {
|
||||
|
|
14
src/winio.c
14
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. */
|
||||
|
|
Loading…
Reference in New Issue