handle NANO_CONTROL_8 even better by doing it in parse_kbinput()

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3452 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2006-04-28 19:27:41 +00:00
parent fbf46a5d88
commit 5f274c4b49
4 changed files with 27 additions and 36 deletions

View File

@ -133,16 +133,10 @@ CVS code -
- nano.c: - nano.c:
renumber() renumber()
- Remove invalid assert. (DLR, found by Filipe Moreira) - Remove invalid assert. (DLR, found by Filipe Moreira)
do_input()
- If we get NANO_CONTROL_8, handle it instead of ignoring it,
for consistency. (DLR)
- nano.h: - nano.h:
- Reorder the toggle #defines to match their corresponding order - Reorder the toggle #defines to match their corresponding order
in toggle_init(). (DLR) in toggle_init(). (DLR)
- prompt.c: - prompt.c:
do_statusbar_input()
- If we get NANO_CONTROL_8, handle it instead of ignoring it,
for consistency. (DLR)
get_prompt_string() get_prompt_string()
- Include the handling of the help key even when help is - Include the handling of the help key even when help is
disabled, so that we aren't erroneously kicked out of the disabled, so that we aren't erroneously kicked out of the
@ -174,6 +168,9 @@ CVS code -
- Change all rcfile error messages to refer to commands instead - Change all rcfile error messages to refer to commands instead
of directives, for consistency with nanorc.5. (DLR) of directives, for consistency with nanorc.5. (DLR)
- winio.c: - winio.c:
parse_kbinput()
- If we get NANO_CONTROL_8, properly handle it in all cases.
(DLR)
get_control_kbinput() get_control_kbinput()
- Add Ctrl-/ as an alias for Ctrl-_. (DLR, found by Benno - Add Ctrl-/ as an alias for Ctrl-_. (DLR, found by Benno
Schulenberg) Schulenberg)

View File

@ -1281,20 +1281,15 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
/* Read in a character. */ /* Read in a character. */
input = get_kbinput(edit, meta_key, func_key); input = get_kbinput(edit, meta_key, func_key);
if (allow_funcs) {
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
/* If we got a mouse click and it was on a shortcut, read in the if (allow_funcs) {
* shortcut character. */ /* If we got a mouse click and it was on a shortcut, read in the
if (*func_key == TRUE && input == KEY_MOUSE) * shortcut character. */
input = do_mouse() ? get_kbinput(edit, meta_key, func_key) : if (allow_funcs && *func_key == TRUE && input == KEY_MOUSE)
input = do_mouse() ? get_kbinput(edit, meta_key, func_key) :
ERR; ERR;
else }
#endif #endif
if (input == NANO_CONTROL_8 && *meta_key == FALSE &&
*func_key == FALSE)
input = ISSET(REBIND_DELETE) ? NANO_BACKSPACE_KEY :
NANO_DELETE_KEY;
}
/* Check for a shortcut in the main list. */ /* Check for a shortcut in the main list. */
s = get_shortcut(main_list, &input, meta_key, func_key); s = get_shortcut(main_list, &input, meta_key, func_key);

View File

@ -68,20 +68,15 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
/* Read in a character. */ /* Read in a character. */
input = get_kbinput(bottomwin, meta_key, func_key); input = get_kbinput(bottomwin, meta_key, func_key);
if (allow_funcs) {
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
/* If we got a mouse click and it was on a shortcut, read in the if (allow_funcs) {
* shortcut character. */ /* If we got a mouse click and it was on a shortcut, read in the
if (*func_key == TRUE && input == KEY_MOUSE) * shortcut character. */
input = do_statusbar_mouse() ? get_kbinput(bottomwin, if (allow_funcs && *func_key == TRUE && input == KEY_MOUSE)
meta_key, func_key) : ERR; input = do_statusbar_mouse() ? get_kbinput(bottomwin, meta_key,
else func_key) : ERR;
}
#endif #endif
if (input == NANO_CONTROL_8 && *meta_key == FALSE &&
*func_key == FALSE)
input = ISSET(REBIND_DELETE) ? NANO_BACKSPACE_KEY :
NANO_DELETE_KEY;
}
/* Check for a shortcut in the current list. */ /* Check for a shortcut in the current list. */
s = get_shortcut(currshortcut, &input, meta_key, func_key); s = get_shortcut(currshortcut, &input, meta_key, func_key);

View File

@ -402,10 +402,6 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
switch (escapes) { switch (escapes) {
case 0: case 0:
switch (*kbinput) { switch (*kbinput) {
case NANO_CONTROL_8:
retval = ISSET(REBIND_DELETE) ?
NANO_DELETE_KEY : NANO_BACKSPACE_KEY;
break;
case KEY_DOWN: case KEY_DOWN:
retval = NANO_NEXTLINE_KEY; retval = NANO_NEXTLINE_KEY;
break; break;
@ -647,10 +643,18 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
} }
} }
/* If we have a result and it's an extended keypad value (i.e, a if (retval != ERR) {
* value outside of byte range), set func_key to TRUE. */ /* If our result is NANO_CONTROL_8, translate it to either
if (retval != ERR) * Backspace or Delete, depending on whether REBIND_DELETE is
* TRUE or FALSE. */
if (retval == NANO_CONTROL_8)
retval = ISSET(REBIND_DELETE) ? NANO_BACKSPACE_KEY :
NANO_DELETE_KEY;
/* If our result is an extended keypad value (i.e, a value
* outside of byte range), set func_key to TRUE. */
*func_key = !is_byte(retval); *func_key = !is_byte(retval);
}
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "parse_kbinput(): kbinput = %d, meta_key = %d, func_key = %d, escapes = %d, byte_digits = %d, retval = %d\n", *kbinput, (int)*meta_key, (int)*func_key, escapes, byte_digits, retval); fprintf(stderr, "parse_kbinput(): kbinput = %d, meta_key = %d, func_key = %d, escapes = %d, byte_digits = %d, retval = %d\n", *kbinput, (int)*meta_key, (int)*func_key, escapes, byte_digits, retval);