Mercurial > public > mercurial-scm > hg-stable
diff hgext/progress.py @ 21862:ba7f75e7f4e5
progress: use 'encoding.trim' to trim items in output line correctly
Before this patch, 'progress' extension trims items in output line by
directly slicing byte sequence, but it may split at intermediate
multi-byte sequence.
This patch uses 'encoding.trim' to trim items in output line
correctly, even if it contains multi-byte characters.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 06 Jul 2014 02:56:41 +0900 |
parents | e382cf9ec30b |
children | f9c91c638378 |
line wrap: on
line diff
--- a/hgext/progress.py Sun Jul 06 02:56:41 2014 +0900 +++ b/hgext/progress.py Sun Jul 06 02:56:41 2014 +0900 @@ -139,9 +139,9 @@ else: wid = 20 if slice == 'end': - add = item[-wid:] + add = encoding.trim(item, wid, leftside=True) else: - add = item[:wid] + add = encoding.trim(item, wid) add += (wid - len(add)) * ' ' elif indicator == 'bar': add = ''