Use a null to represent a blank rather than a space
This has performance benefits when clearing (can use a single memset). Also allows detecting trailing whitespace on lines correctly.
This commit is contained in:
@@ -45,15 +45,15 @@ class TestParser(BaseTest):
|
||||
pb = partial(self.parse_bytes_dump, s)
|
||||
|
||||
pb('12', '12')
|
||||
self.ae(str(s.line(0)), '12 ')
|
||||
self.ae(str(s.line(0)), '12')
|
||||
self.ae(s.cursor.x, 2)
|
||||
pb('3456', '3456')
|
||||
self.ae(str(s.line(0)), '12345')
|
||||
self.ae(str(s.line(1)), '6 ')
|
||||
self.ae(str(s.line(1)), '6')
|
||||
pb(b'\n123\n\r45', ('screen_linefeed',), '123', ('screen_linefeed',), ('screen_carriage_return',), '45')
|
||||
self.ae(str(s.line(1)), '6 ')
|
||||
self.ae(str(s.line(2)), ' 123 ')
|
||||
self.ae(str(s.line(3)), '45 ')
|
||||
self.ae(str(s.line(1)), '6')
|
||||
self.ae(str(s.line(2)), ' 123')
|
||||
self.ae(str(s.line(3)), '45')
|
||||
parse_bytes(s, b'\rabcde')
|
||||
self.ae(str(s.line(3)), 'abcde')
|
||||
pb('\rßxyz1', ('screen_carriage_return',), 'ßxyz1')
|
||||
@@ -65,11 +65,11 @@ class TestParser(BaseTest):
|
||||
s = self.create_screen()
|
||||
pb = partial(self.parse_bytes_dump, s)
|
||||
pb('12\033Da', '12', ('screen_index',), 'a')
|
||||
self.ae(str(s.line(0)), '12 ')
|
||||
self.ae(str(s.line(1)), ' a ')
|
||||
self.ae(str(s.line(0)), '12')
|
||||
self.ae(str(s.line(1)), ' a')
|
||||
pb('\033x', ('Unknown char after ESC: 0x%x' % ord('x'),))
|
||||
pb('\033c123', ('screen_reset', ), '123')
|
||||
self.ae(str(s.line(0)), '123 ')
|
||||
self.ae(str(s.line(0)), '123')
|
||||
|
||||
def test_charsets(self):
|
||||
s = self.create_screen()
|
||||
@@ -79,14 +79,14 @@ class TestParser(BaseTest):
|
||||
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 ')
|
||||
self.ae(str(s.line(0)), '/\xa0')
|
||||
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')), '/_')
|
||||
self.ae(str(s.line(0)), '/\xa0 ')
|
||||
self.ae(str(s.line(0)), '/\xa0')
|
||||
|
||||
def test_csi_codes(self):
|
||||
s = self.create_screen()
|
||||
|
||||
Reference in New Issue
Block a user