mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-13 04:03:16 +02:00
Handle remote print callback in tests
This commit is contained in:
@@ -301,6 +301,13 @@ def text_sanitizer(as_ansi: bool, add_wrap_markers: bool) -> Callable[[str], str
|
||||
return remove_wrap_markers
|
||||
|
||||
|
||||
def process_remote_print(msg: bytes) -> str:
|
||||
from base64 import standard_b64decode
|
||||
from .cli import green
|
||||
text = standard_b64decode(msg).decode('utf-8', 'replace')
|
||||
return text.replace('\x1b', green(r'\e')).replace('\a', green(r'\a')).replace('\0', green(r'\0'))
|
||||
|
||||
|
||||
class EdgeWidths:
|
||||
left: Optional[float]
|
||||
top: Optional[float]
|
||||
@@ -845,11 +852,7 @@ class Window:
|
||||
get_boss().handle_remote_cmd(cmd, self)
|
||||
|
||||
def handle_remote_print(self, msg: bytes) -> None:
|
||||
from base64 import standard_b64decode
|
||||
|
||||
from .cli import green
|
||||
text = standard_b64decode(msg).decode('utf-8')
|
||||
text = text.replace('\x1b', green(r'\e')).replace('\a', green(r'\a')).replace('\0', green(r'\0'))
|
||||
text = process_remote_print(msg)
|
||||
print(text, end='', file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user