mirror of git://git.sv.gnu.org/nano.git
in parse_kbinput(), if we get Escape followed by an escape sequence,
interpret the escape sequence for consistency; also ignore unhandled function keys for consistency git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3565 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
e328ae9423
commit
d6eb17515d
18
ChangeLog
18
ChangeLog
|
@ -97,14 +97,14 @@ CVS code -
|
|||
do_page_down(), do_up(), do_scroll_up(), do_down(),
|
||||
do_scroll_down(), do_input(), do_search(), do_research(), and
|
||||
do_delete(). (DLR)
|
||||
- Ignore unhandled meta key sequences and escape sequences, and
|
||||
indicate it on the statusbar when we get an unhandled shortcut
|
||||
or toggle, as Pico does. To get this to work properly, add a
|
||||
shortcut for moving to the next search/replace string. New
|
||||
function is_ascii_cntrl_char(); changes to shortcut_init(),
|
||||
do_input(), do_statusbar_input(), get_prompt_string(), and
|
||||
parse_kbinput(). (DLR, suggested by Nick Warne and Benno
|
||||
Schulenberg)
|
||||
- Ignore unhandled meta key sequences, function keys, and escape
|
||||
sequences, and indicate it on the statusbar when we get an
|
||||
unhandled shortcut or toggle, as Pico does. To get this to
|
||||
work properly, add a shortcut for moving to the next
|
||||
search/replace string. New function is_ascii_cntrl_char();
|
||||
changes to shortcut_init(), do_input(), do_statusbar_input(),
|
||||
get_prompt_string(), and parse_kbinput(). (DLR, suggested by
|
||||
Nick Warne and Benno Schulenberg)
|
||||
- Explain the mouse support in more detail, and sync the text of
|
||||
its description across all documentation. Changes to nano.1,
|
||||
nanorc.5, nanorc.sample, and nano.texi. (Benno Schulenberg and
|
||||
|
@ -283,6 +283,8 @@ CVS code -
|
|||
parse_kbinput()
|
||||
- If we get NANO_CONTROL_8, properly handle it in all cases.
|
||||
(DLR)
|
||||
- If we get Escape followed by an escape sequence, interpret the
|
||||
escape sequence for consistency. (DLR)
|
||||
get_control_kbinput()
|
||||
- Add Ctrl-/ as an alias for Ctrl-_. (DLR, found by Benno
|
||||
Schulenberg)
|
||||
|
|
|
@ -1297,10 +1297,11 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||
#endif
|
||||
);
|
||||
|
||||
/* If we got a non-high-bit control key or a meta key sequence, and
|
||||
* it's not a shortcut or toggle, throw it out. */
|
||||
/* If we got a non-high-bit control key, a meta key sequence, or a
|
||||
* function key, and it's not a shortcut or toggle, throw it out. */
|
||||
if (*s_or_t == FALSE) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key == TRUE) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key == TRUE ||
|
||||
*func_key == TRUE) {
|
||||
statusbar(_("Unknown Command"));
|
||||
if (*meta_key == TRUE)
|
||||
*meta_key = FALSE;
|
||||
|
|
|
@ -100,10 +100,11 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
|||
/* Set s_or_t to TRUE if we got a shortcut. */
|
||||
*s_or_t = have_shortcut;
|
||||
|
||||
/* If we got a non-high-bit control key or a meta key sequence, and
|
||||
* it's not a shortcut or toggle, throw it out. */
|
||||
/* If we got a non-high-bit control key, a meta key sequence, or a
|
||||
* function key, and it's not a shortcut or toggle, throw it out. */
|
||||
if (*s_or_t == FALSE) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key == TRUE) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key == TRUE ||
|
||||
*func_key == TRUE) {
|
||||
if (*meta_key == TRUE)
|
||||
*meta_key = FALSE;
|
||||
input = ERR;
|
||||
|
|
33
src/winio.c
33
src/winio.c
|
@ -589,7 +589,16 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||
free(byte_mb);
|
||||
free(seq);
|
||||
}
|
||||
} else {
|
||||
/* Two escapes followed by one or more non-decimal
|
||||
* digits: control character sequence mode,
|
||||
* interrupted byte sequence mode, or escape
|
||||
* sequence mode. If there aren't any other keys
|
||||
* waiting, we have either a control character
|
||||
* sequence or an interrupted byte sequence. If
|
||||
* there are other keys waiting, we have a true
|
||||
* escape sequence preceded by an extra escape, so
|
||||
* interpret it. */
|
||||
} else if (get_key_buffer_len() == 0) {
|
||||
/* Reset the escape counter. */
|
||||
escapes = 0;
|
||||
if (byte_digits == 0)
|
||||
|
@ -610,6 +619,28 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||
byte_digits = 0;
|
||||
retval = *kbinput;
|
||||
}
|
||||
} else {
|
||||
int *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 value,
|
||||
* and save that as the result. */
|
||||
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"));
|
||||
|
||||
free(seq);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue