commit 273d2ce2d58640bf60ac812a720995665d4b1459
parent c91696e6df7cbcc2925bc68c32bbfd1194214902
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Fri, 30 Jan 2004 04:20:28 +0000
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
Diffstat:
3 files changed, 25 insertions(+), 18 deletions(-)
diff --git 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
@@ -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
@@ -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