Cleanup kitty dcs parsing

This commit is contained in:
Kovid Goyal
2023-11-07 16:54:17 +05:30
parent 0a6d83901d
commit 50935b6c93
6 changed files with 47 additions and 44 deletions

View File

@@ -83,6 +83,7 @@ class Callbacks:
self.wtcbuf = b''
self.iconbuf = self.colorbuf = self.ctbuf = ''
self.titlebuf = []
self.printbuf = []
self.notifications = []
self.open_urls = []
self.cc_buf = []
@@ -110,7 +111,10 @@ class Callbacks:
def handle_remote_print(self, msg):
text = process_remote_print(msg)
print(text, file=sys.__stdout__, end='', flush=True)
self.printbuf.append(text)
def handle_remote_cmd(self, msg):
pass
def handle_remote_clone(self, msg):
msg = str(msg, 'utf-8')

View File

@@ -423,6 +423,10 @@ class TestParser(BaseTest):
c.clear()
pb('\033P$qr\033\\', ('screen_request_capabilities', ord('$'), 'r'))
self.ae(c.wtcbuf, f'\033P1$r{s.margin_top + 1};{s.margin_bottom + 1}r\033\\'.encode('ascii'))
pb('\033P@kitty-cmd{abc\033\\', ('handle_remote_cmd', '{abc'))
p = base64_encode('abcd').decode()
pb(f'\033P@kitty-print|{p}\033\\', ('handle_remote_print', p))
self.ae(['abcd'], s.callbacks.printbuf)
def test_pending(self):
s = self.create_screen()