Have all marks return a wcwidth of -1

Mirrors recent change to onsidering all marks combining chars instead of
only the marks with a non-zero combining class
This commit is contained in:
Kovid Goyal
2018-01-17 23:25:59 +05:30
parent ed700ff830
commit 2ddc7e8c80
3 changed files with 285 additions and 102 deletions

View File

@@ -34,7 +34,7 @@ def get_data(fname, folder='UCD'):
# Map of class names to set of codepoints in class
class_maps = {}
combining_codepoints = set()
marks = set()
not_assigned = set(range(0, sys.maxunicode))
@@ -57,9 +57,8 @@ def parse_ucd():
for codepoint in codepoints:
s.add(codepoint)
not_assigned.discard(codepoint)
cc = parts[3]
if cc and cc != '0':
combining_codepoints.add(codepoint)
if category.startswith('M'):
marks.add(codepoint)
def split_two(line):
@@ -179,7 +178,7 @@ def gen_wcwidth():
non_printing = class_maps['Cc'] | class_maps['Cf'] | class_maps['Cs']
add(p, 'Non-printing characters', non_printing, -1)
add(p, 'Combining characters', combining_codepoints, -1)
add(p, 'Marks', marks, -1)
add(p, 'Private use', class_maps['Co'], -3)
add(p, 'East Asian ambiguous width', ambiguous, -2)
add(p, 'East Asian double width', doublewidth, 2)