minirst: use colwidth to match title lengths (issue2455) stable
authorMatt Mackall <mpm@selenic.com>
Wed, 27 Oct 2010 15:35:23 -0500
branchstable
changeset 12867 eda77c3e246a
parent 12866 eddc20306ab6
child 12873 e1855dee28c1
minirst: use colwidth to match title lengths (issue2455)
mercurial/minirst.py
--- a/mercurial/minirst.py	Wed Oct 27 15:35:21 2010 -0500
+++ b/mercurial/minirst.py	Wed Oct 27 15:35:23 2010 -0500
@@ -248,7 +248,7 @@
         # +------------------------------+
         if (block['type'] == 'paragraph' and
             len(block['lines']) == 2 and
-            len(block['lines'][0]) == len(block['lines'][1]) and
+            encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
             _sectionre.match(block['lines'][1])):
             block['underline'] = block['lines'][1][0]
             block['type'] = 'section'
@@ -358,7 +358,7 @@
         indent += '  '
         return indent + ('\n' + indent).join(block['lines'])
     if block['type'] == 'section':
-        underline = len(block['lines'][0]) * block['underline']
+        underline = encoding.colwidth(block['lines'][0]) * block['underline']
         return "%s%s\n%s%s" % (indent, block['lines'][0],indent, underline)
     if block['type'] == 'definition':
         term = indent + block['lines'][0]