##// END OF EJS Templates
encoding: add getcols to extract substrings based on column width
Matt Mackall -
r15143:16c129b0 default
parent child Browse files
Show More
@@ -149,6 +149,14 b' def ucolwidth(d):'
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:
General Comments 0
You need to be logged in to leave comments. Login now