From 1671950b3ad74387beea64cd7c54564bfd4a30eb Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Thu, 16 Mar 2017 16:44:55 +0200 Subject: [PATCH] Add colorize support to PupyCmd tables --- pupy/pupylib/PupyCmd.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pupy/pupylib/PupyCmd.py b/pupy/pupylib/PupyCmd.py index 7b9ee159..9fe1291e 100644 --- a/pupy/pupylib/PupyCmd.py +++ b/pupy/pupylib/PupyCmd.py @@ -87,10 +87,14 @@ def get_columns_size(l): for i,k in d.iteritems(): if type(k) is not str: k=str(k) + + escalign=len(''.join(re.findall('(\033[^m]+m)', k))) + l = len(k) - escalign + if not i in size_dic: - size_dic[i]=len(k) - elif size_dic[i]