Skip to content

Commit d42acbe

Browse files
committed
fix test_internal being stuck on test_wrap_text_wide_chars (fix _handle_long_word)
1 parent 38b7333 commit d42acbe

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tabulate/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2775,7 +2775,8 @@ def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):
27752775
chunk = reversed_chunks[-1]
27762776
i = 1
27772777
# Only count printable characters, so strip_ansi first, index later.
2778-
while len(_strip_ansi(chunk)[:i]) <= space_left:
2778+
stripped_chunk = _strip_ansi(chunk)
2779+
while i <= len(stripped_chunk) and self._len(stripped_chunk[:i]) <= space_left:
27792780
i = i + 1
27802781
# Consider escape codes when breaking words up
27812782
total_escape_len = 0

0 commit comments

Comments
 (0)