commit 4a915b1ed581967350591c67965374f90e673030
parent cbf5a5b5d3e7f91135241053e6242ad1a8b42428
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 15 Dec 2023 11:44:14 +0100
input: avoid hanging after a 39-character paste on a VSCode terminal
The terminal in VSCode splits pastes into 50-byte chunks and can
thus split an escape sequence somewhere in the middle, resulting
in nano failing to recognize the end-of-bracketed-paste sequence
and thus hanging -- until another, different-sized paste is made.
Avoid this hang by interpreting any invalid escape sequence that
starts with "\e [ 2" as a truncated end-of-bracketed-paste.
(This will leave a spurious tilde after the 39-character paste,
which is not nice but... better than hanging.)
This works around https://savannah.gnu.org/bugs/?64996.
Reported-by: Jacob Lifshay <programmerjake@gmail.com>
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -737,6 +737,12 @@ int convert_CSI_sequence(const int *seq, size_t length, int *consumed)
bracketed_paste = FALSE;
return BRACKETED_PASTE_MARKER;
}
+ } else {
+ /* When invalid, assume it's a truncated end-of-paste sequence,
+ * in order to avoid a hang -- https://sv.gnu.org/bugs/?64996. */
+ bracketed_paste = FALSE;
+ *consumed = length;
+ return ERR;
}
#endif
break;