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 git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3554 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
5538150e0a
Коммит
8e341e1b22
@ -96,6 +96,12 @@ CVS code -
|
|||||||
do_page_down(), do_up(), do_scroll_up(), do_down(),
|
do_page_down(), do_up(), do_scroll_up(), do_down(),
|
||||||
do_scroll_down(), do_input(), do_search(), do_research(), and
|
do_scroll_down(), do_input(), do_search(), do_research(), and
|
||||||
do_delete(). (DLR)
|
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. New function is_ascii_cntrl_char();
|
||||||
|
changes to do_input(), do_statusbar_input(), and
|
||||||
|
parse_kbinput(). (DLR, suggested by Nick Warne and Benno
|
||||||
|
Schulenberg)
|
||||||
- browser.c:
|
- browser.c:
|
||||||
do_browser()
|
do_browser()
|
||||||
- Reference NANO_GOTODIR_(ALT|F)?KEY instead of
|
- Reference NANO_GOTODIR_(ALT|F)?KEY instead of
|
||||||
|
@ -120,6 +120,13 @@ bool is_blank_mbchar(const char *c)
|
|||||||
return isblank((unsigned char)*c);
|
return isblank((unsigned char)*c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function is equivalent to iscntrl(), except in that it only
|
||||||
|
* handles non-high-bit control characters. */
|
||||||
|
bool is_ascii_cntrl_char(int c)
|
||||||
|
{
|
||||||
|
return (0 <= c && c < 32);
|
||||||
|
}
|
||||||
|
|
||||||
/* This function is equivalent to iscntrl(), except in that it also
|
/* This function is equivalent to iscntrl(), except in that it also
|
||||||
* handles high-bit control characters. */
|
* handles high-bit control characters. */
|
||||||
bool is_cntrl_char(int c)
|
bool is_cntrl_char(int c)
|
||||||
|
11
src/nano.c
11
src/nano.c
@ -1297,6 +1297,17 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* If we got a non-high-bit control key or a Meta key sequence, and
|
||||||
|
* it's not a shortcut or toggle, ignore it, and indicate this on
|
||||||
|
* the statusbar. */
|
||||||
|
if (*s_or_t == FALSE) {
|
||||||
|
if (is_ascii_cntrl_char(input) || *meta_key == TRUE) {
|
||||||
|
input = ERR;
|
||||||
|
*meta_key = FALSE;
|
||||||
|
statusbar(_("Unknown Command"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (allow_funcs) {
|
if (allow_funcs) {
|
||||||
/* If we got a character, and it isn't a shortcut or toggle,
|
/* If we got a character, and it isn't a shortcut or toggle,
|
||||||
* it's a normal text character. Display the warning if we're
|
* it's a normal text character. Display the warning if we're
|
||||||
|
@ -99,6 +99,15 @@ 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. */
|
/* Set s_or_t to TRUE if we got a shortcut. */
|
||||||
*s_or_t = have_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, ignore it. */
|
||||||
|
if (*s_or_t == FALSE) {
|
||||||
|
if (is_ascii_cntrl_char(input) || *meta_key == TRUE) {
|
||||||
|
input = ERR;
|
||||||
|
*meta_key = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (allow_funcs) {
|
if (allow_funcs) {
|
||||||
/* If we got a character, and it isn't a shortcut or toggle,
|
/* If we got a character, and it isn't a shortcut or toggle,
|
||||||
* it's a normal text character. Display the warning if we're
|
* it's a normal text character. Display the warning if we're
|
||||||
|
@ -174,6 +174,7 @@ bool niswblank(wchar_t wc);
|
|||||||
bool is_byte(int c);
|
bool is_byte(int c);
|
||||||
bool is_alnum_mbchar(const char *c);
|
bool is_alnum_mbchar(const char *c);
|
||||||
bool is_blank_mbchar(const char *c);
|
bool is_blank_mbchar(const char *c);
|
||||||
|
bool is_ascii_cntrl_char(int c);
|
||||||
bool is_cntrl_char(int c);
|
bool is_cntrl_char(int c);
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
bool is_cntrl_wchar(wchar_t wc);
|
bool is_cntrl_wchar(wchar_t wc);
|
||||||
|
@ -536,10 +536,10 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||||||
&ignore_seq);
|
&ignore_seq);
|
||||||
|
|
||||||
/* If the escape sequence is unrecognized and
|
/* If the escape sequence is unrecognized and
|
||||||
* not ignored, put back all of its characters
|
* not ignored, indicate this on the
|
||||||
* except for the initial escape. */
|
* statusbar. */
|
||||||
if (retval == ERR && !ignore_seq)
|
if (retval == ERR && !ignore_seq)
|
||||||
unget_input(seq, seq_len);
|
statusbar(_("Unknown Command"));
|
||||||
|
|
||||||
free(seq);
|
free(seq);
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user