in get_kbinput(), make sure meta_key and func_key are set properly in

all cases


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2044 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-11-02 02:48:02 +00:00
parent 4b4b608806
commit 1e1f572c51
1 changed files with 5 additions and 6 deletions

View File

@ -194,13 +194,13 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
*meta_key = TRUE; *meta_key = TRUE;
retval = tolower(kbinput); retval = tolower(kbinput);
/* If the escape sequence is more than one character /* If the escape sequence is more than one character
* long, set meta_key to FALSE, translate the escape * long, set func_key to TRUE, translate the escape
* sequence into the corresponding key value, and save * sequence into the corresponding key value, and save
* that as the result. */ * that as the result. */
} else if (seq_len > 1) { } else if (seq_len > 1) {
bool ignore_seq; bool ignore_seq;
*meta_key = FALSE; *func_key = TRUE;
retval = get_escape_seq_kbinput(sequence, seq_len, retval = get_escape_seq_kbinput(sequence, seq_len,
&ignore_seq); &ignore_seq);
@ -215,9 +215,9 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
} }
/* Handle UTF-8 sequences. */ /* Handle UTF-8 sequences. */
} else if (seq == UTF8_SEQ) { } else if (seq == UTF8_SEQ) {
/* If we have a UTF-8 sequence, set func_key to FALSE, /* If we have a UTF-8 sequence, translate the UTF-8
* translate the UTF-8 sequence into the corresponding * sequence into the corresponding wide character value,
* wide character value, and save that as the result. */ * and save that as the result. */
int i = 0; int i = 0;
char *s = charalloc(seq_len + 1); char *s = charalloc(seq_len + 1);
wchar_t wc; wchar_t wc;
@ -226,7 +226,6 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
s[i] = (char)sequence[i]; s[i] = (char)sequence[i];
s[seq_len] = '\0'; s[seq_len] = '\0';
*func_key = FALSE;
if (mbtowc(&wc, s, MB_CUR_MAX) == -1) { if (mbtowc(&wc, s, MB_CUR_MAX) == -1) {
/* This UTF-8 sequence is unrecognized. Send it /* This UTF-8 sequence is unrecognized. Send it
* back. */ * back. */