# HG changeset patch # User Matt Mackall # Date 1401229012 25200 # Node ID 17da326fd0412e045c4d7a8f89ca69bfb83bdca3 # Parent d0ec3800101a13b59749e955762fe08cca61e2a6 bookmarks: properly align multi-byte characters diff -r d0ec3800101a -r 17da326fd041 mercurial/commands.py --- a/mercurial/commands.py Tue May 27 15:13:13 2014 -0700 +++ b/mercurial/commands.py Tue May 27 15:16:52 2014 -0700 @@ -951,8 +951,9 @@ if ui.quiet: ui.write("%s\n" % bmark, label=label) else: - ui.write(" %s %-25s %d:%s\n" % ( - prefix, bmark, repo.changelog.rev(n), hexfn(n)), + pad = " " * (25 - encoding.colwidth(bmark)) + ui.write(" %s %s%s %d:%s\n" % ( + prefix, bmark, pad, repo.changelog.rev(n), hexfn(n)), label=label) @command('branch', diff -r d0ec3800101a -r 17da326fd041 tests/test-encoding-align.t --- a/tests/test-encoding-align.t Tue May 27 15:13:13 2014 -0700 +++ b/tests/test-encoding-align.t Tue May 27 15:16:52 2014 -0700 @@ -117,14 +117,17 @@ marked working directory as branch \xe7\x9f\xad\xe5\x90\x8d (esc) (branches are permanent and global, did you want a bookmark?) $ hg tag $S + $ hg book -f $S $ hg branch $M marked working directory as branch MIDDLE_ (branches are permanent and global, did you want a bookmark?) $ hg tag $M + $ hg book -f $M $ hg branch $L marked working directory as branch \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d (esc) (branches are permanent and global, did you want a bookmark?) $ hg tag $L + $ hg book -f $L check alignment of branches @@ -142,4 +145,9 @@ MIDDLE_ 3:b06c5b6def9e \xe7\x9f\xad\xe5\x90\x8d 2:64a70663cee8 (esc) - $ cd .. +check alignment of bookmarks + + $ hg book + MIDDLE_ 5:d745ff46155b + \xe7\x9f\xad\xe5\x90\x8d 4:9259be597f19 (esc) + * \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 5:d745ff46155b (esc)