mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 14:34:52 +02:00
Use a single code path for tests and live VT parsing
This commit is contained in:
@@ -25,7 +25,7 @@ from kitty.window import process_remote_print, process_title_from_child
|
||||
|
||||
|
||||
def parse_bytes(screen, data):
|
||||
return screen.vt_parser.parse_bytes(screen, data)
|
||||
return screen.test_write_data(data)
|
||||
|
||||
|
||||
class Callbacks:
|
||||
@@ -324,7 +324,7 @@ class PTY:
|
||||
break
|
||||
bytes_read += len(data)
|
||||
self.received_bytes += data
|
||||
self.screen.vt_parser.parse_bytes(self.screen, data)
|
||||
self.screen.test_write_data(data)
|
||||
return bytes_read
|
||||
|
||||
def wait_till(self, q, timeout=10):
|
||||
|
||||
@@ -23,6 +23,8 @@ class CmdDump(list):
|
||||
def __call__(self, *a):
|
||||
if a and isinstance(a[0], int):
|
||||
a = a[1:]
|
||||
if a and a[0] == 'bytes':
|
||||
return
|
||||
self.append(tuple(map(cnv, a)))
|
||||
|
||||
|
||||
@@ -33,7 +35,7 @@ class TestParser(BaseTest):
|
||||
if isinstance(x, str):
|
||||
x = x.encode('utf-8')
|
||||
cmds = tuple(('draw', x) if isinstance(x, str) else tuple(map(cnv, x)) for x in cmds)
|
||||
s.vt_parser.parse_bytes(s, x, cd)
|
||||
s.test_write_data(x, cd)
|
||||
current = ''
|
||||
q = []
|
||||
for args in cd:
|
||||
@@ -73,7 +75,7 @@ class TestParser(BaseTest):
|
||||
self.ae(str(s.line(1)), '6')
|
||||
self.ae(str(s.line(2)), ' 123')
|
||||
self.ae(str(s.line(3)), '45')
|
||||
s.vt_parser.parse_bytes(s, b'\rabcde')
|
||||
s.test_write_data(b'\rabcde')
|
||||
self.ae(str(s.line(3)), 'abcde')
|
||||
pb('\rßxyz1', ('screen_carriage_return',), 'ßxyz1')
|
||||
self.ae(str(s.line(3)), 'ßxyz1')
|
||||
|
||||
Reference in New Issue
Block a user