diff --git a/ChangeLog b/ChangeLog index 7b49c491b96d6c0aba20214b9702d8cc088406a2..9b79a630b58deae20fda19aa17118125d2a36461 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,9 @@ CVS code - main(). This is consistent with SIGINT, which we trap here and turn off via termios in main(), as well as with the associated comment. (DLR) + handle_sigwinch() + - Set keypad() to TRUE just before calling siglongjmp(), in case + we resized during verbatim input. (DLR) main() - Move the call to raw() on systems that don't define _POSIX_VDISABLE outside the main input/output loop, as it @@ -44,16 +47,15 @@ CVS code - - winio.c: get_verbatim_kbinput() - Set keypad() to FALSE and switch to raw mode while reading - input, and set it keypad() back to TRUE and go back into - cbreak mode afterwards. (Note that if _POSIX_VDISABLE isn't - defined, we don't need to change to or from raw mode since - we're already in it exclusively.) This ensures that we don't - end up reading in extended keypad values that are outside the - ASCII range or having to deal with interrupt-generating key - values. 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) + input, and set it back to TRUE and go back into cbreak mode + mode afterwards. (Note that if _POSIX_VDISABLE isn't defined, + we don't need to change to or from raw mode since we're + already in it exclusively.) This ensures that we don't end up + reading in extended keypad values that are outside the ASCII + range or having to deal with interrupt-generating key values. + 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() diff --git a/src/nano.c b/src/nano.c index 3f05df6e5a35aeed30015fd5c9a25f21bf3af82c..e9eae62e4fe3aedcad538d5f4195aaa846e1aa66 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2967,7 +2967,7 @@ void handle_sigwinch(int s) edit_update(editbot, CENTER); erase(); - /* Do these b/c width may have changed... */ + /* Do these because width may have changed. */ refresh(); titlebar(NULL); edit_refresh(); @@ -2975,10 +2975,15 @@ void handle_sigwinch(int s) blank_statusbar(); total_refresh(); - /* Turn cursor back on for sure */ + /* Turn cursor back on for sure. */ curs_set(1); - /* Jump back to main loop */ + /* Turn the keypad on, so that it still works if we resized during + * verbatim input, for example. */ + keypad(edit, TRUE); + keypad(bottomwin, TRUE); + + /* Jump back to the main loop. */ siglongjmp(jmpbuf, 1); } #endif /* !NANO_SMALL */ @@ -3427,11 +3432,11 @@ int main(int argc, char *argv[]) initscr(); savetty(); nonl(); -#ifndef _POSIX_VDISABLE +#ifdef _POSIX_VDISABLE + cbreak(); +#else /* We're going to have to do it the old way, i.e, on Cygwin. */ raw(); -#else - cbreak(); #endif noecho(); diff --git a/src/winio.c b/src/winio.c index d7ae9955b86d4c762c73f718dde1a796d408f222..d2300a271f430b7908f6b96ab6334e140e58a284 100644 --- a/src/winio.c +++ b/src/winio.c @@ -64,7 +64,7 @@ char *get_verbatim_kbinput(WINDOW *win, int *kbinput_len, * all of which are outside the ASCII range, and switch to raw mode * so that we can type ^Q, ^S, and ^Z without getting interrupts. */ keypad(win, FALSE); -#ifndef _POSIX_VDISABLE +#ifdef _POSIX_VDISABLE raw(); #endif @@ -91,7 +91,7 @@ char *get_verbatim_kbinput(WINDOW *win, int *kbinput_len, /* Turn the keypad back on and switch back to cbreak mode now that * we're done. */ keypad(win, TRUE); -#ifndef _POSIX_VDISABLE +#ifdef _POSIX_VDISABLE cbreak(); #endif