make the UTF-8 character reading support work in more instances

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1991 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-10-15 01:51:36 +00:00
parent 1f204c0204
commit fc965a4869
2 changed files with 7 additions and 8 deletions

View File

@ -71,8 +71,8 @@ CVS code -
suggested by Bill Soudan) suggested by Bill Soudan)
- Remove the -D/--dos and -M/--mac command line options, as they - Remove the -D/--dos and -M/--mac command line options, as they
aren't much use with the new file format autodetection. (DLR) aren't much use with the new file format autodetection. (DLR)
- Add support for reading in UTF-8 sequences to some of the - Add support for reading in UTF-8 sequences to the low-level
low-level input routines. Changes to get_kbinput() and input routines. Changes to get_kbinput() and
get_translated_kbinput(). (DLR) get_translated_kbinput(). (DLR)
- files.c: - files.c:
do_insertfile() do_insertfile()

View File

@ -376,12 +376,6 @@ int get_translated_kbinput(int kbinput, seq_type *seq
break; break;
#endif #endif
default: default:
/* A character with its high bit set: UTF-8
* sequence mode. Set seq to UTF8_SEQ. */
if ((-128 <= kbinput && kbinput < 0) ||
(127 < kbinput && kbinput <= 255))
*seq = UTF8_SEQ;
retval = kbinput; retval = kbinput;
break; break;
} }
@ -461,6 +455,11 @@ int get_translated_kbinput(int kbinput, seq_type *seq
} }
} }
/* A character other than ERR with its high bit set: UTF-8 sequence
* mode. Set seq to UTF8_SEQ. */
if (retval != ERR && 127 < retval && retval <= 255)
*seq = UTF8_SEQ;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "get_translated_kbinput(): kbinput = %d, seq = %d, escapes = %d, ascii_digits = %lu, retval = %d\n", kbinput, (int)*seq, escapes, (unsigned long)ascii_digits, retval); fprintf(stderr, "get_translated_kbinput(): kbinput = %d, seq = %d, escapes = %d, ascii_digits = %lu, retval = %d\n", kbinput, (int)*seq, escapes, (unsigned long)ascii_digits, retval);
#endif #endif