commit e3f6638a76d585717455001d79a47e15b96d8344
parent f8553f6d3a6fa006cff01b96341e570a1415b4de
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 26 Jan 2020 12:22:49 +0100
prompt: for a Yes-No-All, accept the first character of an external paste
Allow the user to paste in the character for Yes, No, or All. If the
paste contains more than one character, ignore all but the first.
This fully fixes https://savannah.gnu.org/bugs/?57623.
Reported-by: Brand Huntsman <alpha@qzx.com>
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/prompt.c b/src/prompt.c
@@ -708,6 +708,12 @@ int do_yesno_prompt(bool all, const char *msg)
/* When not replacing, show the cursor while waiting for a key. */
kbinput = get_kbinput(bottomwin, !all);
+#ifndef NANO_TINY
+ /* Accept the first character of an external paste. */
+ if (bracketed_paste && kbinput == BRACKETED_PASTE_MARKER)
+ kbinput = get_kbinput(bottomwin, BLIND);
+#endif
+
#ifdef ENABLE_NLS
letter[index++] = (unsigned char)kbinput;
#ifdef ENABLE_UTF8
@@ -765,6 +771,12 @@ int do_yesno_prompt(bool all, const char *msg)
#endif /* ENABLE_MOUSE */
else
beep();
+
+#ifndef NANO_TINY
+ /* Ignore the rest of an external paste. */
+ while (bracketed_paste)
+ kbinput = get_kbinput(bottomwin, BLIND);
+#endif
}
return choice;