bindings: with --modern, do not let ^Q^Q quit nano without saving

With --modernbindings, instead accept ^Q^X for abandoning any changes
-- the inverse of the normal (but undocumented) ^X^Q.

This prevents the unintentional loss of work when the user hits ^Q twice
by accident.
This commit is contained in:
Benno Schulenberg 2024-01-21 14:10:09 +01:00
parent 26c75a6828
commit a27da0d75b

View File

@ -752,8 +752,9 @@ int ask_user(bool withall, const char *question)
focusing = TRUE;
}
#endif
/* Interpret ^N and ^Q as "No", to allow exiting in anger. */
else if (kbinput == '\x0E' || kbinput == '\x11')
/* Interpret ^N as "No", to allow exiting in anger, and ^Q or ^X too. */
else if (kbinput == '\x0E' || (kbinput == '\x11' && !ISSET(MODERN_BINDINGS)) ||
(kbinput == '\x18' && ISSET(MODERN_BINDINGS)))
choice = NO;
/* And interpret ^Y as "Yes". */
else if (kbinput == '\x19')