From cb7c1d27f439b22137ba6cb4fb716b87f76880fd Mon Sep 17 00:00:00 2001 From: Niru Maheswaranathan Date: Thu, 18 May 2017 01:23:23 -0700 Subject: [PATCH] Fixes ANSI escape in headers --- .gitignore | 1 + setup.py | 2 +- tableprint.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d46c576..10ee80d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ lib64/ *.zip docs/_build .coverage +.mypy_cache/ diff --git a/setup.py b/setup.py index 2160940..bab43c2 100644 --- a/setup.py +++ b/setup.py @@ -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. diff --git a/tableprint.py b/tableprint.py index b907453..5870e53 100644 --- a/tableprint.py +++ b/tableprint.py @@ -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)