equal
deleted
inserted
replaced
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 |