You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wrap() retains trailing spaces before SGR sequences with drop_whitespace=True #332
This affects coloured narrow-column CLI output: the plain text version trims the space, but adding an SGR prefix leaves it visible. Reproduced in both line_break='unicode' and 'ascii', with SGR propagation enabled and disabled, on current master / Linux / CPython 3.12.14.
When a long word's leading sequence is assigned to the preceding full line, its final character is no longer whitespace, so the final str.rstrip() misses the space before that sequence. The existing _rstrip_visible() helper can remove that whitespace while preserving trailing sequences; sequence-only inputs still need to be retained.
Four regression cases fail before the fix; six controls cover drop_whitespace=False and sequence-only input. A focused Python fix passes all 392 text-wrapping tests and the full Python suite/doctests (1,966 passed, 56 skipped).
Activity
Fix trailing spaces before terminal sequences in Python wrap
Fix trailing spaces before terminal sequences in Python wrap