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

Color output breaks line length #272

Closed
henryiii opened this issue Jun 29, 2024 · 6 comments
Closed

Color output breaks line length #272

henryiii opened this issue Jun 29, 2024 · 6 comments

Comments

@henryiii
Copy link

If a command produces colored output, it messes up the code box. It almost works, I think it's just counting the control sequence length incorrectly.

Screenshot 2024-06-29 at 12 52 37 AM

@mfontanini
Copy link
Owner

I'll need to look at this, I never tried colored output and I'm not surprised it breaks. One issue for sure is that the escape sequences are considered normal text so that causes what you see in the image where the coloring of each line at the end is missing. But yes, there's clearly more going on.

@DrunkenToast
Copy link
Contributor

If I find the time I wouldn't mind taking a jab at this issue.
I believe we can just escape ansi codes before calculating the padding, something like this crate might do the job if we don't mind introducing dependencies.

@mfontanini
Copy link
Owner

If you'd like to give it a shot, go for it. The execution output is handled here and the attribute you want to change should be this one. Ideally we'd compute the real length only once and then store it so this thing would need to have more than just a string.

@mfontanini
Copy link
Owner

This was fixed in #315.

@henryiii
Copy link
Author

henryiii commented Aug 2, 2024

Thanks!

@henryiii
Copy link
Author

henryiii commented Aug 2, 2024

That's a link to an issue, by the way, not a PR. I think you meant #316.

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

Successfully merging a pull request may close this issue.

3 participants