# HG changeset patch # User Matt Mackall # Date 1288211723 18000 # Node ID eda77c3e246a318d7456a9c9f359274df681b8d7 # Parent eddc20306ab62de11d13b9460b3b5910677ee867 minirst: use colwidth to match title lengths (issue2455) diff -r eddc20306ab6 -r eda77c3e246a 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]