Mercurial > hg
comparison tests/test-subrepo-recursion.t @ 21857:86c2d792a4b7
util: replace 'ellipsis' implementation by 'encoding.trim'
Before this patch, 'util.ellipsis' tried to avoid splitting at
intermediate multi-byte sequence, but its implementation was incorrect.
Internal function '_ellipsis' trims specified unicode sequence not at
most maxlength 'columns in display', but at most maxlength number of
'unicode characters'.
def _ellipsis(text, maxlength):
if len(text) <= maxlength:
return text, False
else:
return "%s..." % (text[:maxlength - 3]), True
In many encodings, number of unicode characters can be different from
columns in display.
This patch replaces 'ellipsis' implementation by 'encoding.trim',
which can trim string at most maxlength columns in display correctly,
even though specified string contains multi-byte characters.
'_ellipsis' is removed in this patch, because it is referred only from
'ellipsis'.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 06 Jul 2014 02:56:41 +0900 |
parents | 9e3910db4e78 |
children | df463ca0adef |
comparison
equal
deleted
inserted
replaced
21856:d24969ee272f | 21857:86c2d792a4b7 |
---|