- New function used to write the current marked selection to a
file, split out from do_writeout(). (DLR)
- nano.c:
+ do_verbatim_input()
+ - Remove the now-unneeded code to disable XON, XOFF, and
+ suspend, since we now go into raw mode in
+ get_verbatim_kbinput() and bypass them. (DLR)
do_spell(), do_int_speller(), do_alt_speller()
- Modify to write only the current selection from a file to the
temporary file used for spell checking when the mark is on,
main()
- Move the call to raw() on systems that don't define
_POSIX_VDISABLE outside the main input/output loop, as it
- doesn't need to be called every time through the loop. (DLR)
+ doesn't need to be called every time through the loop. Call it
+ instead of cbreak() on such systems, as it overrides cbreak()
+ anyway. (DLR)
- search.c:
do_replace_loop()
- Fix segfault when doing a regex replace of a string that
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
+ - 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.)
+ 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)
{
char *verbatim_kbinput; /* Used to hold verbatim input */
int verbatim_len; /* Length of verbatim input */
- int old_preserve = ISSET(PRESERVE), old_suspend = ISSET(SUSPEND);
int i;
- /* Turn off Ctrl-Q (XON), Ctrl-S (XOFF), and Ctrl-Z (suspend) if
- * they're on, so that we can use them to insert ^Q, ^S, and ^Z
- * verbatim. */
- if (old_preserve)
- UNSET(PRESERVE);
- if (old_suspend)
- UNSET(SUSPEND);
- if (old_preserve || old_suspend)
- signal_init();
-
statusbar(_("Verbatim input"));
verbatim_kbinput = get_verbatim_kbinput(edit, &verbatim_len, 1);
free(verbatim_kbinput);
- /* Turn Ctrl-Q, Ctrl-S, and Ctrl-Z back on if they were on
- * before. */
- if (old_preserve)
- SET(PRESERVE);
- if (old_suspend)
- SET(SUSPEND);
- if (old_preserve || old_suspend)
- signal_init();
-
return 1;
}
initscr();
savetty();
nonl();
- cbreak();
- noecho();
-
#ifndef _POSIX_VDISABLE
/* We're going to have to do it the old way, i.e, on Cygwin. */
raw();
+#else
+ cbreak();
#endif
+ noecho();
/* Set up some global variables */
global_init(0);
int kbinput;
/* Turn the keypad off so that we don't get extended keypad values,
- * all of which are outside the ASCII range. */
+ * 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
+ raw();
+#endif
kbinput = wgetch(win);
verbatim_kbinput = charalloc(1);
nodelay(win, FALSE);
}
- /* Turn the keypad back on now that we're done. */
+ /* Turn the keypad back on and switch back to cbreak mode now that
+ * we're done. */
keypad(win, TRUE);
+#ifndef _POSIX_VDISABLE
+ cbreak();
+#endif
#ifdef DEBUG
fprintf(stderr, "get_verbatim_kbinput(): verbatim_kbinput = %s\n", verbatim_kbinput);