set keypad() to TRUE in handle_sigwinch() in case we resize during

verbatim input, and fix backwards _POSIX_VDISABLE #ifdefs so that raw()
and cbreak() are called properly in get_verbatim_kbinput()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1640 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-01-30 04:20:28 +00:00
parent c91696e6df
commit 273d2ce2d5
3 changed files with 25 additions and 18 deletions

View File

@ -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()

View File

@ -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();

View File

@ -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