nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [PATCH] bindings: at a Yes-No prompt, accept also ^N and ^Q


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH] bindings: at a Yes-No prompt, accept also ^N and ^Q for "No"
Date: Mon, 13 May 2019 19:48:36 +0200

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.
---
 src/prompt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/prompt.c b/src/prompt.c
index 953330a9..8a67cdea 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -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;
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]