diff options
| author | shimizukawa <shimizukawa@gmail.com> | 2013-02-06 00:29:59 +0900 |
|---|---|---|
| committer | shimizukawa <shimizukawa@gmail.com> | 2013-02-06 00:29:59 +0900 |
| commit | 9bd8c2371bf682cb420d8fa0435e77e641b3530b (patch) | |
| tree | 6d2803620de86da708531572db3606d24ba0eacc /sphinx | |
| parent | 32a005fe1a5d16c6005e5d2dc14183b25583aa6b (diff) | |
| download | sphinx-9bd8c2371bf682cb420d8fa0435e77e641b3530b.tar.gz | |
Fix text builder did not respect wide/fullwidth charactors for table layout.
Diffstat (limited to 'sphinx')
| -rw-r--r-- | sphinx/writers/text.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index 21a27a17..f42d637a 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -393,7 +393,7 @@ class TextTranslator(nodes.NodeVisitor): for i, cell in enumerate(line): par = my_wrap(cell, width=colwidths[i]) if par: - maxwidth = max(map(len, par)) + maxwidth = max(map(column_width, par)) else: maxwidth = 0 realwidths[i] = max(realwidths[i], maxwidth) @@ -413,7 +413,9 @@ class TextTranslator(nodes.NodeVisitor): out = ['|'] for i, cell in enumerate(line): if cell: - out.append(' ' + cell.ljust(realwidths[i]+1)) + adjust_len = len(cell) - column_width(cell) + out.append(' ' + cell.ljust( + realwidths[i] + 1 + adjust_len)) else: out.append(' ' * (realwidths[i] + 2)) out.append('|') |
