diff hgext/progress.py @ 21863:f9c91c638378

progress: use 'encoding.colwidth' to get column width of items correctly Before this patch, 'progress' extension applies 'len' on byte sequence to get column width of it, but it causes incorrect result, when length of byte sequence and columns in display are different from each other in multi-byte characters. This patch uses 'encoding.colwidth' to get column width of 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 ba7f75e7f4e5
children 8b5b963ba95a
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
@@ -142,7 +142,7 @@
                     add = encoding.trim(item, wid, leftside=True)
                 else:
                     add = encoding.trim(item, wid)
-                add += (wid - len(add)) * ' '
+                add += (wid - encoding.colwidth(add)) * ' '
             elif indicator == 'bar':
                 add = ''
                 needprogress = True