Mercurial > hg
changeset 24315:7d5f935bd705
crecord: use encoding.ucolwidth
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 16 Mar 2015 13:22:37 -0500 |
parents | 348492ba632a |
children | d61aa383e2e5 |
files | mercurial/crecord.py |
diffstat | 1 files changed, 2 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/crecord.py Mon Mar 16 12:58:06 2015 -0500 +++ b/mercurial/crecord.py Mon Mar 16 13:22:37 2015 -0500 @@ -877,13 +877,8 @@ width = self.xscreensize # turn tabs into spaces instr = instr.expandtabs(4) - try: - strlen = len(unicode(encoding.fromlocal(instr), code)) - except Exception: - # if text is not utf8, then assume an 8-bit single-byte encoding. - strlen = len(instr) - - numspaces = (width - ((strlen + xstart) % width) - 1) + strwidth = encoding.ucolwidth(instr) + numspaces = (width - ((strwidth + xstart) % width) - 1) return instr + " " * numspaces + "\n" def printstring(self, window, text, fgcolor=None, bgcolor=None, pair=None,