Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behaviour when wrapping ANSI escape codes #248

Closed
taylorconor opened this issue Dec 8, 2020 · 3 comments · Fixed by #249
Closed

Unexpected behaviour when wrapping ANSI escape codes #248

taylorconor opened this issue Dec 8, 2020 · 3 comments · Fixed by #249
Labels

Comments

@taylorconor
Copy link

Hello!

I understand that ANSI wrapping support was added in #140. However adding ANSI codes to the example string from the README produces unexpected line wrapping:

fn main() {
    let text = "\u{001b}[31mtextwrap\u{001b}[0m: an efficient and powerful library for wrapping text.";
    println!("{}", textwrap::fill(text, 28));
}

produces:

textwrap: an
efficient and powerful
library for wrapping text.

expected:

textwrap: an efficient
and powerful library for
wrapping text.
@mgeisler
Copy link
Owner

mgeisler commented Dec 9, 2020

Hi Conor, nice to see you here :)

That looks weird indeed... I'll have to investigate a bit.

mgeisler added a commit that referenced this issue Dec 9, 2020
This was broken by the rewrite in #221 and we only had coverage for a
single case of wrapping colored text.

Fixes #248.
@mgeisler
Copy link
Owner

mgeisler commented Dec 9, 2020

Thanks for catching this! I'll be fixed in a minute!

@mgeisler
Copy link
Owner

This is fixed in the newly released version 0.13.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants