bindings: at a Yes-No prompt, accept also ^N and ^Q for "No"

When wanting to exit after having modified a buffer by mistake, I don't
want to politely answer a question by typing precisely an unmodified N,
I want to give a command: ^N, meaning *No!*.  Or seen another way: I
don't want to be obliged to let go of the Ctrl key before typing N.

When at startup --tempfile was used, the user can discard a modified
buffer with ^O ^Q.  It would be nice when (without --tempfile) ^X ^Q
would work too.
This commit is contained in:
Benno Schulenberg 2019-05-13 19:02:34 +02:00
parent 368f1a1c9d
commit 341601e1a2
1 changed files with 3 additions and 0 deletions

View File

@ -738,6 +738,9 @@ int do_yesno_prompt(bool all, const char *msg)
choice = 2;
else if (func_from_key(&kbinput) == do_cancel)
choice = -1;
/* Interpret ^N and ^Q as "No", to allow exiting in anger. */
else if (kbinput == '\x0E' || kbinput == '\x11')
choice = 0;
#ifdef ENABLE_MOUSE
else if (kbinput == KEY_MOUSE) {
int mouse_x, mouse_y;