commit a27da0d75b96277953d5b8615748c696ec39df58
parent 26c75a682808ad672ee5f20f6087d44435b1b41b
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 21 Jan 2024 14:10:09 +0100
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.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/prompt.c b/src/prompt.c
@@ -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')