mercurial/encoding.py
changeset 43679 7cf332318f62
parent 43637 7edc07fb890c
child 43680 3364a15f61f0
equal deleted inserted replaced
43678:52e4bfebc4ba 43679:7cf332318f62
   325     index start'''
   325     index start'''
   326     for x in pycompat.xrange(start + c, len(s)):
   326     for x in pycompat.xrange(start + c, len(s)):
   327         t = s[start:x]
   327         t = s[start:x]
   328         if colwidth(t) == c:
   328         if colwidth(t) == c:
   329             return t
   329             return t
       
   330     raise ValueError('substring not found')
   330 
   331 
   331 
   332 
   332 def trim(s, width, ellipsis=b'', leftside=False):
   333 def trim(s, width, ellipsis=b'', leftside=False):
   333     # type: (bytes, int, bytes, bool) -> bytes
   334     # type: (bytes, int, bytes, bool) -> bytes
   334     """Trim string 's' to at most 'width' columns (including 'ellipsis').
   335     """Trim string 's' to at most 'width' columns (including 'ellipsis').