Fixes ANSI escape in headers

This commit is contained in:
Niru Maheswaranathan
2017-05-18 01:23:23 -07:00
parent 69fea15bd2
commit cb7c1d27f4
3 changed files with 3 additions and 2 deletions

1
.gitignore vendored
View File

@@ -8,3 +8,4 @@ lib64/
*.zip
docs/_build
.coverage
.mypy_cache/

View File

@@ -6,7 +6,7 @@ setup(
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.6.0',
version='0.6.1',
description='Pretty console printing of tabular data',
long_description='''Formatted console printing of tabular data.

View File

@@ -132,7 +132,7 @@ def header(headers, width=WIDTH, style=STYLE, add_hr=True):
tablestyle = styles[style]
# string formatter
data = map(lambda x: ('{:^%d}' % width).format(x), headers)
data = map(lambda x: ('{:^%d}' % (width + _ansi_len(x))).format(x), headers)
# build the formatted str
headerstr = _format_line(data, tablestyle.row)