Restore support for alternate character sets

Needed by the execrable ncurses. Adds an extra branch in the hot path,
sigh. Thanks to branch prediction it doesnt have any measurable impact
on the benchmark, thankfully.
This commit is contained in:
Kovid Goyal
2024-02-15 12:50:54 +05:30
parent c19488f3be
commit 4caf8a6b14
6 changed files with 231 additions and 6 deletions

View File

@@ -76,6 +76,20 @@ class TestParser(BaseTest):
parse_bytes(s, x, cd)
self.ae(cmds, cd.get_result())
def test_charsets(self):
s = self.create_screen()
pb = partial(self.parse_bytes_dump, s)
pb(b'\xc3')
pb(b'\xa1', ('draw', b'\xc3\xa1'.decode('utf-8')))
s = self.create_screen()
pb = partial(self.parse_bytes_dump, s)
pb('\033)0\x0e/_', ('screen_designate_charset', 1, ord('0')), ('screen_change_charset', 1), '/_')
self.ae(str(s.line(0)), '/\xa0')
s = self.create_screen()
pb = partial(self.parse_bytes_dump, s)
pb('\033(0/_', ('screen_designate_charset', 0, ord('0')), '/_')
self.ae(str(s.line(0)), '/\xa0')
def test_parser_threading(self):
s = self.create_screen()