This commit is contained in:
Kovid Goyal 2022-09-24 08:30:40 +05:30
parent 9d98aa3159
commit a0495219ab
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 1 deletions

View file

@ -1091,7 +1091,7 @@ def docs_url(which: str = '', local_docs_root: Optional[str] = '') -> str:
def sanitize_for_bracketed_paste(text: bytes) -> bytes:
pat = re.compile(b'(?:(?:\033\\[)|(?:\x9b))201~')
while True:
new_text = pat.sub(text, b'')
new_text = pat.sub(b'', text)
if new_text == text:
break
text = new_text

View file

@ -566,3 +566,4 @@ def test_bracketed_paste_sanitizer(self):
q = sanitize_for_bracketed_paste(x.encode('utf-8'))
self.assertNotIn(b'\x1b[201~', q)
self.assertNotIn('\x9b201~'.encode('utf-8'), q)
self.assertIn(b'ab', q)