From 3f272d102b26f347d2ad932435c24e06181d5241 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 28 Apr 2017 09:41:47 +0530 Subject: [PATCH] Test for toggling IUTF8 --- kitty_tests/__init__.py | 4 ++++ kitty_tests/parser.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kitty_tests/__init__.py b/kitty_tests/__init__.py index 45d67af6d..6a7e2cc32 100644 --- a/kitty_tests/__init__.py +++ b/kitty_tests/__init__.py @@ -33,10 +33,14 @@ class Callbacks: def buf_toggled(self, is_alt): self.is_alt = is_alt + def use_utf8(self, on): + self.iutf8 = on + def clear(self): self.wtcbuf = b'' self.iconbuf = self.titlebuf = self.colorbuf = self.qbuf = self.ctbuf = '' self.is_alt = False + self.iutf8 = True def filled_line_buf(ynum=5, xnum=5, cursor=Cursor()): diff --git a/kitty_tests/parser.py b/kitty_tests/parser.py index fee0c43d0..74c111377 100644 --- a/kitty_tests/parser.py +++ b/kitty_tests/parser.py @@ -80,7 +80,9 @@ class TestParser(BaseTest): 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 ') - pb('\033%G_', ('screen_use_latin1', 0), '_') + self.assertTrue(s.callbacks.iutf8) + pb('\033%@_', ('screen_use_latin1', 1), '_') + self.assertFalse(s.callbacks.iutf8) s = self.create_screen() pb = partial(self.parse_bytes_dump, s) pb('\033(0/_', ('screen_designate_charset', 0, ord('0')), '/_')