Commit 58f6d836 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

set keypad() to FALSE while reading in verbatim input, to deal with a

bit of xterm weirdness, and update a few keypad-related comments


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1637 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 24 additions and 5 deletions
+24 -5
......@@ -33,6 +33,14 @@ CVS code -
matches inside a line (e.g. replace the "b" in "abc" with
anything). (David Benbennick)
- winio.c:
get_verbatim_kbinput()
- Set keypad() to FALSE while reading input, and set it back to
TRUE afterwards. This ensures that we don't end up reading in
extended keypad values that are outside the ASCII range.
(Also, with keypad() set to TRUE, xterm generates
KEY_BACKSPACE when the user hits Ctrl-H, which, when cut down
to ASCII range, ends up being Ctrl-G, which can be confusing.)
(DLR)
get_accepted_kbinput()
- Don't use "kbinput = wgetch(win)" as a switch value. (DLR)
get_escape_seq_kbinput()
......
......@@ -240,7 +240,8 @@ void window_init(void)
topwin = newwin(2, COLS, 0, 0);
bottomwin = newwin(3 - no_help(), COLS, LINES - 3 + no_help(), 0);
/* This is so the keypad still works after a Meta-X, for example. */
/* Turn the keypad on, so that it still works after a Meta-X, for
* example. */
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
}
......@@ -3468,6 +3469,7 @@ int main(int argc, char *argv[])
mouse_init();
#endif
/* Turn the keypad on */
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
......
......@@ -58,8 +58,13 @@ char *get_verbatim_kbinput(WINDOW *win, int *kbinput_len,
int allow_ascii)
{
char *verbatim_kbinput;
int kbinput = wgetch(win);
int kbinput;
/* Turn the keypad off so that we don't get extended keypad values,
* all of which are outside the ASCII range. */
keypad(win, FALSE);
kbinput = wgetch(win);
verbatim_kbinput = charalloc(1);
verbatim_kbinput[0] = kbinput;
*kbinput_len = 1;
......@@ -79,6 +84,9 @@ char *get_verbatim_kbinput(WINDOW *win, int *kbinput_len,
nodelay(win, FALSE);
}
/* Turn the keypad back on now that we're done. */
keypad(win, TRUE);
#ifdef DEBUG
fprintf(stderr, "get_verbatim_kbinput(): verbatim_kbinput = %s\n", verbatim_kbinput);
#endif
......@@ -308,9 +316,10 @@ int get_ascii_kbinput(WINDOW *win, int kbinput)
return retval;
}
/* Translate escape sequences for extended keypad values. These are
* generated when the terminal doesn't support the needed keys. Assume
* that Escape has already been read in, and that nodelay(win) is TRUE.
/* Translate escape sequences, most of which correspond to extended
* keypad values. These sequences are generated when the terminal
* doesn't support the needed keys. Assume that Escape has already been
* read in, and that nodelay(win) is TRUE.
*
* The supported terminals are the Linux console, the FreeBSD console,
* the Hurd console (a.k.a. the Mach console), xterm, rxvt, and Eterm.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment