When pasting in bracketed paste mode and the cursor is at a shell prompt, strip out C0 control codes

Some shells incorrectly interpret these allowing escape from bracketed paste mode. Thanks to David Leadbetter for discovering.
This commit is contained in:
Kovid Goyal
2023-10-20 12:17:13 +05:30
parent f098240ace
commit 56963c693e
4 changed files with 8 additions and 2 deletions

View File

@@ -590,6 +590,7 @@ class TestDataTypes(BaseTest):
self.assertNotIn(b'\x1b[201~', q)
self.assertNotIn('\x9b201~'.encode('utf-8'), q)
self.assertIn(b'ab', q)
self.assertNotIn(b'\x03', sanitize_for_bracketed_paste(b'hi\x03world', True))
def test_expand_ansi_c_escapes(self):
for src, expected in {