equal
deleted
inserted
replaced
147 eaw = getattr(unicodedata, 'east_asian_width', None) |
147 eaw = getattr(unicodedata, 'east_asian_width', None) |
148 if eaw is not None: |
148 if eaw is not None: |
149 return sum([eaw(c) in wide and 2 or 1 for c in d]) |
149 return sum([eaw(c) in wide and 2 or 1 for c in d]) |
150 return len(d) |
150 return len(d) |
151 |
151 |
|
152 def getcols(s, start, c): |
|
153 '''Use colwidth to find a c-column substring of s starting at byte |
|
154 index start''' |
|
155 for x in xrange(start + c, len(s)): |
|
156 t = s[start:x] |
|
157 if colwidth(t) == c: |
|
158 return t |
|
159 |
152 def lower(s): |
160 def lower(s): |
153 "best-effort encoding-aware case-folding of local string s" |
161 "best-effort encoding-aware case-folding of local string s" |
154 try: |
162 try: |
155 if isinstance(s, localstr): |
163 if isinstance(s, localstr): |
156 u = s._utf8.decode("utf-8") |
164 u = s._utf8.decode("utf-8") |