diff --git a/src/chars.c b/src/chars.c index 81536e37..23fbba49 100644 --- a/src/chars.c +++ b/src/chars.c @@ -56,12 +56,6 @@ char *addstrings(char* str1, size_t len1, char* str2, size_t len2) return str1; } -/* Return TRUE if the value of c is in byte range, and FALSE otherwise. */ -bool is_byte(int c) -{ - return ((unsigned int)c == (unsigned char)c); -} - /* This function is equivalent to isalpha() for multibyte characters. */ bool is_alpha_mbchar(const char *c) { @@ -110,13 +104,6 @@ bool is_blank_mbchar(const char *c) return isblank((unsigned char)*c); } -/* This function is equivalent to iscntrl(), except in that it only - * handles non-high-bit control characters. */ -bool is_ascii_cntrl_char(int c) -{ - return (0 <= c && c < 32); -} - /* This function is equivalent to iscntrl() for multibyte characters, * except in that it also handles multibyte control characters with * their high bits set. */ diff --git a/src/nano.c b/src/nano.c index 436a6262..91962adc 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1531,7 +1531,7 @@ void do_input(void) /* If we got a non-high-bit control key, a meta key sequence, or a * function key, and it's not a shortcut or toggle, throw it out. */ if (shortcut == NULL) { - if (is_ascii_cntrl_char(input) || meta_key || !is_byte(input)) { + if (input < 0x20 || input > 0xFF || meta_key) { unbound_key(input); input = ERR; } diff --git a/src/prompt.c b/src/prompt.c index f872038e..d863d5fd 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -90,7 +90,7 @@ int do_statusbar_input(bool *finished) /* If we got a non-high-bit control key, a meta key sequence, or a * function key, and it's not a shortcut or toggle, throw it out. */ if (shortcut == NULL) { - if (is_ascii_cntrl_char(input) || meta_key || !is_byte(input)) { + if (input < 0x20 || input > 0xFF || meta_key) { beep(); input = ERR; } diff --git a/src/proto.h b/src/proto.h index 30449d27..dfb3d7f6 100644 --- a/src/proto.h +++ b/src/proto.h @@ -204,10 +204,8 @@ void utf8_init(void); bool using_utf8(void); #endif char *addstrings(char* str1, size_t len1, char* str2, size_t len2); -bool is_byte(int c); bool is_alpha_mbchar(const char *c); bool is_blank_mbchar(const char *c); -bool is_ascii_cntrl_char(int c); bool is_cntrl_mbchar(const char *c); bool is_word_mbchar(const char *c, bool allow_punct); char control_mbrep(const char *c, bool isdata);