input: don't crash when the window is resized during verbatim input

Instead of referring to a window that might have been deleted by a
resize, just turn the keypad back on for the two windows from which
input might have been requested.

Also: don't insert KEY_WINCH as the verbatim keystroke.

This fixes https://savannah.gnu.org/bugs/?48532.
master
Benno Schulenberg 2016-07-16 22:11:14 +02:00
parent 1d4c1e0bfc
commit 103dd06347
1 changed files with 13 additions and 2 deletions

View File

@ -1375,8 +1375,12 @@ int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
* keypad back on if necessary now that we're done. */
if (ISSET(PRESERVE))
enable_flow_control();
if (!ISSET(REBIND_KEYPAD))
keypad(win, TRUE);
/* Use the global window pointers, because a resize may have freed
* the data that the win parameter points to. */
if (!ISSET(REBIND_KEYPAD)) {
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
}
return retval;
}
@ -1393,6 +1397,13 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
while ((kbinput = get_input(win, 1)) == NULL)
;
/* When the window was resized, abort and return nothing. */
if (*kbinput == KEY_WINCH) {
*kbinput_len = 0;
free(kbinput);
return NULL;
}
#ifdef ENABLE_UTF8
if (using_utf8()) {
/* Check whether the first keystroke is a valid hexadecimal