mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-11 19:19:35 +02:00
Always ask for confirmation when pasting text with control codes in it
This commit is contained in:
@@ -1135,16 +1135,13 @@ def docs_url(which: str = '', local_docs_root: Optional[str] = '') -> str:
|
||||
return url
|
||||
|
||||
|
||||
def sanitize_for_bracketed_paste(text: bytes, at_shell_prompt: bool = False) -> bytes:
|
||||
def sanitize_for_bracketed_paste(text: bytes) -> bytes:
|
||||
pat = re.compile(b'(?:(?:\033\\\x5b)|(?:\x9b))201~')
|
||||
while True:
|
||||
new_text = pat.sub(b'', text)
|
||||
if new_text == text:
|
||||
break
|
||||
text = new_text
|
||||
if at_shell_prompt:
|
||||
# some shells dont handle C0 control codes in pasted text correctly
|
||||
text = re.sub(b'[\x00-\x1f]+', b'', text)
|
||||
return text
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user