nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 341601e1a2c86053586d90d21d6071db24d1da01
parent 368f1a1c9d20fa8595d9071054f6b92c7d65c794
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Mon, 13 May 2019 19:02:34 +0200

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.

Diffstat:
Msrc/prompt.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git 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;