in parse_kbinput(), properly handle combined control character and
escape sequences, so that e.g. Esc Esc / will work properly when the / is on the numeric keypad and NumLock is off git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3811 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
ec177be416
commit
f28ff9dece
|
@ -136,7 +136,10 @@ CVS code -
|
|||
parse_kbinput()
|
||||
- Properly handle combined meta and escape sequences, so that
|
||||
e.g. Meta-+ will work properly when the + is on the numeric
|
||||
keypad and NumLock is off. (DLR)
|
||||
keypad and NumLock is off. Also, properly handle combined
|
||||
control character and escape sequences, so that e.g. Esc Esc /
|
||||
will work properly when the / is on the numeric keypad and
|
||||
NumLock is off. (DLR)
|
||||
- Translate extended keypad keys to their ASCII equivalents even
|
||||
when we hit Escape once or twice before typing them, for
|
||||
consistency. (DLR)
|
||||
|
|
26
src/winio.c
26
src/winio.c
|
@ -347,11 +347,13 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||
/* One escape: wait for more input. */
|
||||
case 2:
|
||||
/* Two escapes: wait for more input. */
|
||||
case 3:
|
||||
/* Three escapes: wait for more input. */
|
||||
break;
|
||||
default:
|
||||
/* More than two escapes: reset the escape counter
|
||||
* and wait for more input. */
|
||||
escapes = 0;
|
||||
/* More than three escapes: limit the escape counter
|
||||
* to no more than two, and wait for more input. */
|
||||
escapes %= 3;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -466,6 +468,24 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||
*kbinput);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
/* Reset the escape counter. */
|
||||
escapes = 0;
|
||||
if (get_key_buffer_len() == 0)
|
||||
/* Three escapes followed by a non-escape, and
|
||||
* there aren't any other keystrokes waiting:
|
||||
* normal input mode. Save the non-escape
|
||||
* character as the result. */
|
||||
retval = *kbinput;
|
||||
else
|
||||
/* Three escapes followed by a non-escape, and
|
||||
* there are other keystrokes waiting: combined
|
||||
* control character and escape sequence mode.
|
||||
* Interpret the escape sequence, and interpret
|
||||
* the result as a control sequence. */
|
||||
retval = get_control_kbinput(
|
||||
parse_escape_seq_kbinput(win,
|
||||
*kbinput));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue