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.
This commit is contained in:
Benno Schulenberg 2020-07-08 16:14:08 +02:00
parent 1542cbf942
commit 97a993d401

View File

@ -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))