in parse_escape_seq_kbinput(), Don't ignore escape sequences anymore;
instead, return the corresponding key so that parse_kbinput() can translate it git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3814 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
722b728a1c
commit
1b4ae6997e
|
@ -149,6 +149,9 @@ CVS code -
|
||||||
parse_escape_seq_kbinput()
|
parse_escape_seq_kbinput()
|
||||||
- Handle unknown and unignored escape sequences once here
|
- Handle unknown and unignored escape sequences once here
|
||||||
instead of twice in parse_kbinput(). (DLR)
|
instead of twice in parse_kbinput(). (DLR)
|
||||||
|
- Don't ignore escape sequences anymore. Instead, return the
|
||||||
|
corresponding key so that parse_kbinput() can translate it.
|
||||||
|
(DLR)
|
||||||
display_string()
|
display_string()
|
||||||
- Properly handle buf[start_index]'s being a null terminator.
|
- Properly handle buf[start_index]'s being a null terminator.
|
||||||
(DLR)
|
(DLR)
|
||||||
|
|
|
@ -732,8 +732,7 @@ void unget_kbinput(int kbinput, bool meta_key, bool func_key);
|
||||||
int *get_input(WINDOW *win, size_t input_len);
|
int *get_input(WINDOW *win, size_t input_len);
|
||||||
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
||||||
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
||||||
int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
int get_escape_seq_kbinput(const int *seq, size_t seq_len);
|
||||||
*ignore_seq);
|
|
||||||
int get_escape_seq_abcd(int kbinput);
|
int get_escape_seq_abcd(int kbinput);
|
||||||
int parse_escape_seq_kbinput(WINDOW *win, int kbinput);
|
int parse_escape_seq_kbinput(WINDOW *win, int kbinput);
|
||||||
int get_byte_kbinput(int kbinput);
|
int get_byte_kbinput(int kbinput);
|
||||||
|
|
30
src/winio.c
30
src/winio.c
|
@ -669,18 +669,12 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||||
|
|
||||||
/* Translate escape sequences, most of which correspond to extended
|
/* Translate escape sequences, most of which correspond to extended
|
||||||
* keypad values, into their corresponding key values. These sequences
|
* keypad values, into their corresponding key values. These sequences
|
||||||
* are generated when the keypad doesn't support the needed keys. If
|
* are generated when the keypad doesn't support the needed keys.
|
||||||
* the escape sequence is recognized but we want to ignore it, return
|
* Assume that Escape has already been read in. */
|
||||||
* ERR and set ignore_seq to TRUE; if it's unrecognized, return ERR and
|
int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
* set ignore_seq to FALSE. Assume that Escape has already been read
|
|
||||||
* in. */
|
|
||||||
int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
|
||||||
*ignore_seq)
|
|
||||||
{
|
{
|
||||||
int retval = ERR;
|
int retval = ERR;
|
||||||
|
|
||||||
*ignore_seq = FALSE;
|
|
||||||
|
|
||||||
if (seq_len > 1) {
|
if (seq_len > 1) {
|
||||||
switch (seq[0]) {
|
switch (seq[0]) {
|
||||||
case 'O':
|
case 'O':
|
||||||
|
@ -718,7 +712,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
||||||
break;
|
break;
|
||||||
case 'E': /* Esc O E == Center (5) on numeric keypad
|
case 'E': /* Esc O E == Center (5) on numeric keypad
|
||||||
* with NumLock off on xterm. */
|
* with NumLock off on xterm. */
|
||||||
*ignore_seq = TRUE;
|
retval = KEY_B2;
|
||||||
break;
|
break;
|
||||||
case 'F': /* Esc O F == End on xterm. */
|
case 'F': /* Esc O F == End on xterm. */
|
||||||
retval = NANO_END_KEY;
|
retval = NANO_END_KEY;
|
||||||
|
@ -829,7 +823,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
||||||
case 'u': /* Esc O u == Center (5) on numeric keypad
|
case 'u': /* Esc O u == Center (5) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* rxvt/Eterm. */
|
* rxvt/Eterm. */
|
||||||
*ignore_seq = TRUE;
|
retval = KEY_B2;
|
||||||
break;
|
break;
|
||||||
case 'v': /* Esc O v == Right (6) on numeric keypad
|
case 'v': /* Esc O v == Right (6) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
|
@ -1045,7 +1039,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
||||||
break;
|
break;
|
||||||
case 'E': /* Esc [ E == Center (5) on numeric keypad
|
case 'E': /* Esc [ E == Center (5) on numeric keypad
|
||||||
* with NumLock off on FreeBSD console. */
|
* with NumLock off on FreeBSD console. */
|
||||||
*ignore_seq = TRUE;
|
retval = KEY_B2;
|
||||||
break;
|
break;
|
||||||
case 'F': /* Esc [ F == End on FreeBSD
|
case 'F': /* Esc [ F == End on FreeBSD
|
||||||
* console/Eterm. */
|
* console/Eterm. */
|
||||||
|
@ -1169,7 +1163,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "get_escape_seq_kbinput(): retval = %d, ignore_seq = %s\n", retval, *ignore_seq ? "TRUE" : "FALSE");
|
fprintf(stderr, "get_escape_seq_kbinput(): retval = %d\n", retval);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -1201,7 +1195,6 @@ int parse_escape_seq_kbinput(WINDOW *win, int kbinput)
|
||||||
{
|
{
|
||||||
int retval, *seq;
|
int retval, *seq;
|
||||||
size_t seq_len;
|
size_t seq_len;
|
||||||
bool ignore_seq;
|
|
||||||
|
|
||||||
/* Put back the non-escape character, get the complete escape
|
/* Put back the non-escape character, get the complete escape
|
||||||
* sequence, translate the sequence into its corresponding key
|
* sequence, translate the sequence into its corresponding key
|
||||||
|
@ -1209,13 +1202,12 @@ int parse_escape_seq_kbinput(WINDOW *win, int kbinput)
|
||||||
unget_input(&kbinput, 1);
|
unget_input(&kbinput, 1);
|
||||||
seq_len = get_key_buffer_len();
|
seq_len = get_key_buffer_len();
|
||||||
seq = get_input(NULL, seq_len);
|
seq = get_input(NULL, seq_len);
|
||||||
retval = get_escape_seq_kbinput(seq, seq_len, &ignore_seq);
|
retval = get_escape_seq_kbinput(seq, seq_len);
|
||||||
|
|
||||||
free(seq);
|
free(seq);
|
||||||
|
|
||||||
/* If we got an unrecognized escape sequence, and it's not ignored,
|
/* If we got an unrecognized escape sequence, throw it out. */
|
||||||
* throw it out. */
|
if (retval == ERR) {
|
||||||
if (retval == ERR && !ignore_seq) {
|
|
||||||
if (win == edit) {
|
if (win == edit) {
|
||||||
statusbar(_("Unknown Command"));
|
statusbar(_("Unknown Command"));
|
||||||
beep();
|
beep();
|
||||||
|
@ -1223,7 +1215,7 @@ int parse_escape_seq_kbinput(WINDOW *win, int kbinput)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "parse_escape_seq_kbinput(): kbinput = %d, ignore_seq = %s, seq_len = %lu, retval = %d\n", kbinput, ignore_seq ? "TRUE" : "FALSE", (unsigned long)seq_len, retval);
|
fprintf(stderr, "parse_escape_seq_kbinput(): kbinput = %d, seq_len = %lu, retval = %d\n", kbinput, (unsigned long)seq_len, retval);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
Loading…
Reference in New Issue