no longer needed. (David Benbennick)
- Rename several variables to make their use clearer and to
avoid conflicts. (DLR)
+ - Set the input mode before turning the keypad on. (DLR)
- files.c:
do_insertfile()
- Wrap one reference to NANO_EXTCMD_KEY in a NANO_SMALL #ifdef.
curses setup routines, and turn the keypad on before setting
the input mode. (DLR)
- Remove stray HAVE_GETOPT_LONG #ifdefs. (DLR)
+ - Don't call keypad() before initializing the windows it needs
+ via window_init().
- nano.h:
- Move the NANO_H include guard up before the first #include.
(DLR)
if (editwinrows < MIN_EDITOR_ROWS)
die_too_small();
- if (edit != NULL)
- delwin(edit);
if (topwin != NULL)
delwin(topwin);
+ if (edit != NULL)
+ delwin(edit);
if (bottomwin != NULL)
delwin(bottomwin);
- /* Set up the main text window. */
- edit = newwin(editwinrows, COLS, 2, 0);
-
- /* And the other windows. */
+ /* Set up the windows. */
topwin = newwin(2, COLS, 0, 0);
+ edit = newwin(editwinrows, COLS, 2, 0);
bottomwin = newwin(3 - no_help(), COLS, LINES - 3 + no_help(), 0);
- /* Turn the keypad on, so that it still works after a Meta-X. */
+ /* Turn the keypad on in the windows we'll be reading input from. */
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
}
/* Turn cursor back on for sure. */
curs_set(1);
- /* Turn the keypad on and switch to cbreak mode, so that the keypad
+ /* Switch to cbreak mode and turn the keypad on, so that the keypad
* and input still work if we resized during verbatim input. */
- keypad(edit, TRUE);
- keypad(bottomwin, TRUE);
#ifdef _POSIX_VDISABLE
cbreak();
#endif
+ keypad(edit, TRUE);
+ keypad(bottomwin, TRUE);
/* Jump back to the main loop. */
siglongjmp(jmpbuf, 1);
#endif /* !NANO_SMALL */
/* If the NumLock key has made the keypad go awry, print an error
- message; hopefully we can address it later. */
+ * message; hopefully we can address it later. */
void print_numlock_warning(void)
{
static int didmsg = 0;
/* Curses initialization stuff: Start curses, save the state of the
* the terminal mode, disable translation of carriage return (^M)
* into newline (^J) so we can catch the Enter key and use ^J for
- * Justify, turn the keypad on for the windows that read input, put
- * the terminal in cbreak mode (read one character at a time and
- * interpret the special control keys) if we can selectively disable
- * the special control keys or raw mode (read one character at a
- * time and don't interpret the special control keys) if we
+ * Justify, put the terminal in cbreak mode (read one character at a
+ * time and interpret the special control keys) if we can selectively
+ * disable the special control keys or raw mode (read one character
+ * at a time and don't interpret the special control keys) if we
* can't, and turn off echoing of characters as they're typed. */
initscr();
savetty();
nonl();
- keypad(edit, TRUE);
- keypad(bottomwin, TRUE);
#ifdef _POSIX_VDISABLE
cbreak();
#else
allow_pending_sigwinch(TRUE);
#endif
- /* Turn the keypad off so that we don't get extended keypad values,
- * all of which are outside the ASCII range, and switch to raw mode
- * so that we can type ^C, ^Q, ^S, ^Z, and ^\ (and ^Y on the Hurd)
- * without getting interrupts. */
- keypad(win, FALSE);
+ /* Switch to raw mode so that we can type ^C, ^Q, ^S, ^Z, and ^\
+ * (and ^Y on the Hurd) without getting interrupts, and Turn the
+ * keypad off so that we don't get extended keypad values all of
+ * which are outside the ASCII range. */
#ifdef _POSIX_VDISABLE
raw();
#endif
+ keypad(win, FALSE);
kbinput = wgetch(win);
verbatim_kbinput = (int *)nmalloc(sizeof(int));
nodelay(win, FALSE);
}
- /* Turn the keypad back on and switch back to cbreak mode now that
+ /* Switch back to cbreak mode and turn the keypad back on now that
* we're done. */
- keypad(win, TRUE);
#ifdef _POSIX_VDISABLE
cbreak();
#endif
+ keypad(win, TRUE);
#ifdef DEBUG
fprintf(stderr, "get_verbatim_kbinput(): verbatim_kbinput = %s\n", verbatim_kbinput);