mercurial/encoding.py
changeset 11297 d320e70442a5
parent 10282 08a0f04b56bd
child 11892 2be70ca17311
equal deleted inserted replaced
11296:0054a328b98f 11297:d320e70442a5
    70 def colwidth(s):
    70 def colwidth(s):
    71     "Find the column width of a UTF-8 string for display"
    71     "Find the column width of a UTF-8 string for display"
    72     d = s.decode(encoding, 'replace')
    72     d = s.decode(encoding, 'replace')
    73     if hasattr(unicodedata, 'east_asian_width'):
    73     if hasattr(unicodedata, 'east_asian_width'):
    74         w = unicodedata.east_asian_width
    74         w = unicodedata.east_asian_width
    75         return sum([w(c) in 'WF' and 2 or 1 for c in d])
    75         return sum([w(c) in 'WFA' and 2 or 1 for c in d])
    76     return len(d)
    76     return len(d)
    77 
    77