Mercurial > public > mercurial-scm > hg-stable
diff hgext/churn.py @ 21163:9846b40d01e7 stable
churn: compute padding with unicode strings
Most UTF-8 aware terminals convert multibyte sequences into a single displayed
characters. Because the first column is padded by counting bytes, the second
column is not perfectly aligned in the presence of non ASCII characters.
author | Isaac Jurado <diptongo@gmail.com> |
---|---|
date | Sat, 19 Apr 2014 15:11:25 +0200 |
parents | e96e9f805c19 |
children | 75c8720092ba |
line wrap: on
line diff
--- a/hgext/churn.py Thu Apr 17 19:39:04 2014 -0400 +++ b/hgext/churn.py Sat Apr 19 15:11:25 2014 +0200 @@ -10,6 +10,7 @@ from mercurial.i18n import _ from mercurial import patch, cmdutil, scmutil, util, templater, commands +from mercurial import encoding import os import time, datetime @@ -124,7 +125,7 @@ Aliases will be split from the rightmost "=". ''' def pad(s, l): - return (s + " " * l)[:l] + return s + " " * (l - encoding.colwidth(s)) amap = {} aliases = opts.get('aliases')