Mercurial > public > mercurial-scm > hg
comparison mercurial/utils/stringutil.py @ 38783:e7aa113b14f7
global: use pycompat.xrange()
On Python 3, our module importer automatically rewrites xrange()
to pycompat.xrange().
We want to move away from the custom importer on Python 3.
This commit converts all instances of xrange() to use
pycompat.xrange().
Differential Revision: https://phab.mercurial-scm.org/D4032
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 01 Aug 2018 13:00:45 -0700 |
parents | a3130208db1c |
children | 2aebe138ef6e |
comparison
equal
deleted
inserted
replaced
38782:7eba8f83129b | 38783:e7aa113b14f7 |
---|---|
462 This requires use decision to determine width of such characters. | 462 This requires use decision to determine width of such characters. |
463 """ | 463 """ |
464 def _cutdown(self, ucstr, space_left): | 464 def _cutdown(self, ucstr, space_left): |
465 l = 0 | 465 l = 0 |
466 colwidth = encoding.ucolwidth | 466 colwidth = encoding.ucolwidth |
467 for i in xrange(len(ucstr)): | 467 for i in pycompat.xrange(len(ucstr)): |
468 l += colwidth(ucstr[i]) | 468 l += colwidth(ucstr[i]) |
469 if space_left < l: | 469 if space_left < l: |
470 return (ucstr[:i], ucstr[i:]) | 470 return (ucstr[:i], ucstr[i:]) |
471 return ucstr, '' | 471 return ucstr, '' |
472 | 472 |