Skip to content

Commit ce0c5e5

Browse files
author
Nikalexis Nikos
committed
Fix some color issue with multi-line in cells
1 parent b160320 commit ce0c5e5

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

texttable.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,15 +628,15 @@ def _splitit(self, line, isheader):
628628
c = "".join(ansi_keep) + c
629629
ansi_keep = []
630630
extra_width = 0
631-
for a in re.findall(r'\x1b[^m]*m', cell):
631+
for a in re.findall(r'\x1b[^m]*m', c):
632632
extra_width += len(a)
633-
if a == "\033[0m":
634-
if len(a) > 0:
633+
if a == '\x1b[0m':
634+
if len(ansi_keep) > 0:
635635
ansi_keep.pop()
636636
else:
637637
ansi_keep.append(a)
638-
c = c + "\033[0m" * len(ansi_keep)
639-
extra_width += len("\033[0m" * len(ansi_keep))
638+
c = c + '\x1b[0m' * len(ansi_keep)
639+
extra_width += len('\x1b[0m' * len(ansi_keep))
640640
if type(c) is not str:
641641
try:
642642
c = str(c, 'utf')

0 commit comments

Comments
 (0)