Make debug_print remove esc and bel

Should really be made more robust, but cant be bothered
This commit is contained in:
Kovid Goyal 2021-07-14 22:07:15 +05:30
parent 85f6d3fed8
commit 179c2b21c0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -778,6 +778,11 @@ class Window:
def handle_remote_print(self, msg: bytes) -> None:
from base64 import standard_b64decode
text = standard_b64decode(msg).decode('utf-8')
def green(x: str) -> str:
return f'\x1b[32m{x}\x1b[39m'
text = text.replace('\x1b', green(r'\e')).replace('\a', green(r'\a')).replace('\0', green(r'\0'))
print(text, end='', file=sys.stderr)
sys.stderr.flush()