Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: astanin/python-tabulate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6b01c3853f03f201b77a6472903e75cd0ae3c40d
Choose a base ref
..
head repository: astanin/python-tabulate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 53561b1fe1a2dca40914705bf72ddee0aaa92b1d
Choose a head ref
Showing with 5 additions and 2 deletions.
  1. +5 −2 tabulate/__init__.py
7 changes: 5 additions & 2 deletions tabulate/__init__.py
Original file line number Diff line number Diff line change
@@ -2685,11 +2685,14 @@ def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):
if _ansi_codes.search(chunk) is not None:
for group, _, _, _ in _ansi_codes.findall(chunk):
escape_len = len(group)
if group in chunk[last_group: i + total_escape_len + escape_len - 1]:
if (
group
in chunk[last_group : i + total_escape_len + escape_len - 1]
):
total_escape_len += escape_len
found = _ansi_codes.search(chunk[last_group:])
last_group += found.end()
cur_line.append(chunk[: i + total_escape_len - 1])
cur_line.append(chunk[: i + total_escape_len - 1])
reversed_chunks[-1] = chunk[i + total_escape_len - 1 :]

# Otherwise, we have to preserve the long word intact. Only add