textwrap
textwrap copied to clipboard
consider treating ANSI/CSI/OSC sequences as zero width
When wrapping, consider skipping over escape sequences such as those used for color control.
This way colorized messages can be wrapped.
Maybe https://docs.rs/strip-ansi-escapes/latest/strip_ansi_escapes/ has suitable code to steal.
Hi @samliddicott,
Thanks for looking at Textwrap and opening issues. What is your use-case for Textwrap?
When wrapping, consider skipping over escape sequences such as those used for color control.
This way colorized messages can be wrapped.
We already do this: the display_width function will unconditionally skip across such escape sequences. The function is used for all width computations in the library.
Did you run into a problem using the wrapping functions on colored terminal text?