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-d3aeb78583b8
Этот коммит содержится в:
родитель
ec177be416
Коммит
f28ff9dece
@ -136,7 +136,10 @@ CVS code -
|
|||||||
parse_kbinput()
|
parse_kbinput()
|
||||||
- Properly handle combined meta and escape sequences, so that
|
- Properly handle combined meta and escape sequences, so that
|
||||||
e.g. Meta-+ will work properly when the + is on the numeric
|
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
|
- Translate extended keypad keys to their ASCII equivalents even
|
||||||
when we hit Escape once or twice before typing them, for
|
when we hit Escape once or twice before typing them, for
|
||||||
consistency. (DLR)
|
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. */
|
/* One escape: wait for more input. */
|
||||||
case 2:
|
case 2:
|
||||||
/* Two escapes: wait for more input. */
|
/* Two escapes: wait for more input. */
|
||||||
|
case 3:
|
||||||
|
/* Three escapes: wait for more input. */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* More than two escapes: reset the escape counter
|
/* More than three escapes: limit the escape counter
|
||||||
* and wait for more input. */
|
* to no more than two, and wait for more input. */
|
||||||
escapes = 0;
|
escapes %= 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -466,6 +468,24 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||||||
*kbinput);
|
*kbinput);
|
||||||
}
|
}
|
||||||
break;
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user