don't display "Unknown Command" on the statusbar if we get an unknown
escape sequence at the statusbar prompt git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3631 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
c504e40a81
Коммит
f102208c05
@ -721,7 +721,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
||||
int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
||||
*ignore_seq);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int parse_escape_seq_kbinput(int kbinput);
|
||||
int parse_escape_seq_kbinput(int kbinput, bool *ignore_seq);
|
||||
int get_byte_kbinput(int kbinput);
|
||||
#ifdef ENABLE_UTF8
|
||||
long add_unicode_digit(int kbinput, long factor, long *uni);
|
||||
|
36
src/winio.c
36
src/winio.c
@ -517,8 +517,20 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||
if (get_key_buffer_len() == 0) {
|
||||
*meta_key = TRUE;
|
||||
retval = tolower(*kbinput);
|
||||
} else
|
||||
retval = parse_escape_seq_kbinput(*kbinput);
|
||||
} else {
|
||||
bool ignore_seq;
|
||||
|
||||
retval = parse_escape_seq_kbinput(*kbinput,
|
||||
&ignore_seq);
|
||||
|
||||
/* If the escape sequence is unrecognized and
|
||||
* not ignored, throw it out. */
|
||||
if (retval == ERR && *ignore_seq == FALSE) {
|
||||
if (win == edit)
|
||||
statusbar(_("Unknown Command"));
|
||||
beep();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
/* Two escapes followed by one or more decimal
|
||||
@ -1140,13 +1152,14 @@ int get_escape_seq_abcd(int kbinput)
|
||||
}
|
||||
|
||||
/* Interpret the escape sequence in the keystroke buffer, the first
|
||||
* character of which is kbinput. Assume that the keystroke buffer
|
||||
* isn't empty, and that the initial escape has already been read in. */
|
||||
int parse_escape_seq_kbinput(int kbinput)
|
||||
* character of which is kbinput. If we want to ignore the escape
|
||||
* sequence, set retval to ERR and ignore_seq to TRUE. Assume that the
|
||||
* keystroke buffer isn't empty, and that the initial escape has already
|
||||
* been read in. */
|
||||
int parse_escape_seq_kbinput(int kbinput, bool *ignore_seq)
|
||||
{
|
||||
int retval, *seq;
|
||||
size_t seq_len;
|
||||
bool ignore_seq;
|
||||
|
||||
/* Put back the non-escape character, get the complete escape
|
||||
* sequence, translate the sequence into its corresponding key
|
||||
@ -1154,19 +1167,12 @@ int parse_escape_seq_kbinput(int kbinput)
|
||||
unget_input(&kbinput, 1);
|
||||
seq_len = get_key_buffer_len();
|
||||
seq = get_input(NULL, seq_len);
|
||||
retval = get_escape_seq_kbinput(seq, seq_len, &ignore_seq);
|
||||
|
||||
/* If the escape sequence is unrecognized and not ignored, throw it
|
||||
* out, and indicate this on the statusbar. */
|
||||
if (retval == ERR && !ignore_seq) {
|
||||
statusbar(_("Unknown Command"));
|
||||
beep();
|
||||
}
|
||||
retval = get_escape_seq_kbinput(seq, seq_len, ignore_seq);
|
||||
|
||||
free(seq);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "parse_escape_seq_kbinput(): kbinput = %d, seq_len = %lu, ignore_seq = %d, retval = %d\n", kbinput, (unsigned long)seq_len, (int)ignore_seq, retval);
|
||||
fprintf(stderr, "parse_escape_seq_kbinput(): kbinput = %d, ignore_seq = %d, seq_len = %lu, retval = %d\n", kbinput, (int)ignore_seq, (unsigned long)seq_len, retval);
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user