Handle non-BMP combining characters

Use a level of indirection to store combining characters. This allows
combining characters to be stored using only two bytes, even if they are
after USHORT_MAX
This commit is contained in:
Kovid Goyal
2018-01-18 16:25:42 +05:30
parent 32632264ee
commit 80301d465b
6 changed files with 36 additions and 34 deletions

View File

@@ -140,7 +140,7 @@ class TestDataTypes(BaseTest):
lb = filled_line_buf(5, 5, filled_cursor())
l0 = lb.line(0)
l0.add_combining_char(1, 'a')
l0.add_combining_char(1, '\u0300')
l0.clear_text(1, 2)
self.ae(str(l0), '0 00')
self.assertEqualAttributes(l0.cursor_from(1), l0.cursor_from(0))
@@ -164,14 +164,14 @@ class TestDataTypes(BaseTest):
lb.line(0)[lb.xnum]
l0 = lb.line(0)
l0.set_text(' ', 0, len(' '), C())
l0.add_combining_char(0, '1')
self.ae(l0[0], ' 1')
l0.add_combining_char(0, '2')
self.ae(l0[0], ' 12')
l0.add_combining_char(0, '3')
self.ae(l0[0], ' 13')
l0.add_combining_char(0, '\u0300')
self.ae(l0[0], ' \u0300')
l0.add_combining_char(0, '\U000e0100')
self.ae(l0[0], ' \u0300\U000e0100')
l0.add_combining_char(0, '\u0302')
self.ae(l0[0], ' \u0300\u0302')
self.ae(l0[1], '\0')
self.ae(str(l0), ' 13')
self.ae(str(l0), ' \u0300\u0302')
t = 'Testing with simple text'
lb = LineBuf(2, len(t))
l0 = lb.line(0)