Show More
@@ -140,12 +140,12 b' ambiguous = os.environ.get("HGENCODINGAM' | |||||
140 | def colwidth(s): |
|
140 | def colwidth(s): | |
141 | "Find the column width of a UTF-8 string for display" |
|
141 | "Find the column width of a UTF-8 string for display" | |
142 | d = s.decode(encoding, 'replace') |
|
142 | d = s.decode(encoding, 'replace') | |
143 |
|
|
143 | eaw = getattr(unicodedata, 'east_asian_width', None) | |
|
144 | if eaw is not None: | |||
144 | wide = "WF" |
|
145 | wide = "WF" | |
145 | if ambiguous == "wide": |
|
146 | if ambiguous == "wide": | |
146 | wide = "WFA" |
|
147 | wide = "WFA" | |
147 | w = unicodedata.east_asian_width |
|
148 | return sum([eaw(c) in wide and 2 or 1 for c in d]) | |
148 | return sum([w(c) in wide and 2 or 1 for c in d]) |
|
|||
149 | return len(d) |
|
149 | return len(d) | |
150 |
|
150 | |||
151 | def lower(s): |
|
151 | def lower(s): |
General Comments 0
You need to be logged in to leave comments.
Login now