mercurial/encoding.py
changeset 15143 16c129b0f465
parent 15142 176882876780
child 15672 2ebe3d0ce91d
--- a/mercurial/encoding.py	Wed Sep 21 13:00:41 2011 -0500
+++ b/mercurial/encoding.py	Wed Sep 21 13:00:46 2011 -0500
@@ -149,6 +149,14 @@
         return sum([eaw(c) in wide and 2 or 1 for c in d])
     return len(d)
 
+def getcols(s, start, c):
+    '''Use colwidth to find a c-column substring of s starting at byte
+    index start'''
+    for x in xrange(start + c, len(s)):
+        t = s[start:x]
+        if colwidth(t) == c:
+            return t
+
 def lower(s):
     "best-effort encoding-aware case-folding of local string s"
     try: