diff -ur nano-1.3.5/src/nano.c nano-1.3.5-fixed/src/nano.c --- nano-1.3.5/src/nano.c 2004-11-22 20:59:18.000000000 -0500 +++ nano-1.3.5-fixed/src/nano.c 2005-01-19 10:00:25.000000000 -0500 @@ -2399,7 +2399,7 @@ * such space, and force is TRUE, then we find the first space. Anyway, * we then take the last space in that group of spaces. The terminating * '\0' counts as a space. */ -int break_line(const char *line, ssize_t goal, bool force) +ssize_t break_line(const char *line, ssize_t goal, bool force) { ssize_t space_loc = -1; /* Current tentative return value. Index of the last space we diff -ur nano-1.3.5/src/nano.h nano-1.3.5-fixed/src/nano.h --- nano-1.3.5/src/nano.h 2004-11-08 23:08:48.000000000 -0500 +++ nano-1.3.5-fixed/src/nano.h 2005-01-19 10:03:07.000000000 -0500 @@ -162,7 +162,7 @@ } topmidnone; typedef enum { - NO_SEQ, ESCAPE_SEQ, UTF8_SEQ + NO_SEQ, ESCAPE_SEQ } seq_type; /* Structure types. */ diff -ur nano-1.3.5/src/winio.c nano-1.3.5-fixed/src/winio.c --- nano-1.3.5/src/winio.c 2004-11-22 20:59:18.000000000 -0500 +++ nano-1.3.5-fixed/src/winio.c 2005-01-19 10:05:35.000000000 -0500 @@ -112,30 +112,15 @@ #endif /* Put back the input character stored in kbinput. If meta_key is TRUE, - * put back the Escape character after putting back kbinput. */ + * put back the Escape character after putting back kbinput. If + * func_key is TRUE, put back the function key (a value outside byte + * range) without putting it in byte range. */ void unget_kbinput(int kbinput, bool meta_key, bool func_key) { - /* If this character is outside the ASCII range and func_key is - * FALSE, treat it as a wide character and put back its equivalent - * UTF-8 sequence. */ - if (kbinput > 255 && !func_key) - { - int i; - char *s = charalloc(MB_CUR_MAX + 1); - wchar_t wc = (wchar_t)kbinput; - - i = wctomb(s, wc); + if (!func_key) + kbinput = (char)kbinput; - if (i == -1) - /* This wide character is unrecognized. Send it back. */ - ungetch(kbinput); - else { - for (; i > 0; i--) - ungetch(s[i - 1]); - } - free(s); - } else - ungetch(kbinput); + ungetch(kbinput); if (meta_key) ungetch(NANO_CONTROL_3); } @@ -221,29 +206,6 @@ retval = sequence[0]; } } - /* Handle UTF-8 sequences. */ - } else if (seq == UTF8_SEQ) { - /* If we have a UTF-8 sequence, translate the UTF-8 - * sequence into the corresponding wide character value, - * and save that as the result. */ - int i = 0; - char *s = charalloc(seq_len + 1); - wchar_t wc; - - for (; i < seq_len; i++) - s[i] = (char)sequence[i]; - s[seq_len] = '\0'; - - if (mbtowc(&wc, s, MB_CUR_MAX) == -1) { - /* This UTF-8 sequence is unrecognized. Send it - * back. */ - for (; seq_len > 1; seq_len--) - unget_kbinput(sequence[seq_len - 1], FALSE, - FALSE); - retval = sequence[0]; - } else - retval = wc; - free(s); } free(sequence); } @@ -262,8 +224,8 @@ /* Translate acceptable ASCII, extended keypad values, and escape and * UTF-8 sequences into their corresponding key values. Set seq to - * ESCAPE_SEQ when we get an escape sequence, or UTF8_SEQ when we get a - * UTF-8 sequence. Assume nodelay(win) is FALSE. */ + * ESCAPE_SEQ when we get an escape sequence. Assume nodelay(win) is + * FALSE. */ int get_translated_kbinput(int kbinput, seq_type *seq #ifndef NANO_SMALL , bool reset @@ -492,11 +454,6 @@ } } - /* 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 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