From 97a993d40159beb27604eb161fa48d626f548568 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 8 Jul 2020 16:14:08 +0200 Subject: [PATCH] verbatim: turn bracketed-paste mode off while waiting for input This allows pasting six hexadecimal digits after typing M-V in order to enter a specific Unicode character. This fixes https://savannah.gnu.org/bugs/?58730. Bug existed since version 4.8, since bracketed pastes were introduced in commit f705a967. --- src/winio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/winio.c b/src/winio.c index f69a5595..89908dbd 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1545,6 +1545,12 @@ char *get_verbatim_kbinput(WINDOW *win, size_t *count) if (!ISSET(RAW_SEQUENCES)) keypad(win, FALSE); +#ifndef NANO_TINY + /* Turn bracketed-paste mode off. */ + printf("\e[?2004l"); + fflush(stdout); +#endif + /* Read in a single byte or two escapes. */ input = parse_verbatim_kbinput(win, count); @@ -1560,6 +1566,12 @@ char *get_verbatim_kbinput(WINDOW *win, size_t *count) } } +#ifndef NANO_TINY + /* Turn bracketed-paste mode back on. */ + printf("\e[?2004h"); + fflush(stdout); +#endif + /* Turn flow control characters back on if necessary and turn the * keypad back on if necessary now that we're done. */ if (ISSET(PRESERVE))