-
Notifications
You must be signed in to change notification settings - Fork 122
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
Text wrapping in a table breaks color configuration #330
Comments
What is the |
|
Found the issue, and a workaround. Issue is because fatih/color library uses Workaround: Use this: fmt.Sprintf("%s %s",
color.New(color.FgHiRed, color.Bold).Sprint("Bold Title"),
color.New(color.FgHiRed).Sprint("This line should be colored in red"),
), instead of: color.New(color.FgHiRed).Sprintf("%s %s", color.New(color.Bold).Sprint("Bold Title"), "This line should be colored in red"), I'll see what I can do to handle this case without the workaround. |
The fix is part of tag v6.6.0 @ https://github.com/jedib0t/go-pretty/releases/tag/v6.6.0 - please let me know if you face any issues with this release. |
Describe the bug
When using the table library to format text with by setting
text.WrapText
andWidthMax
, if the text contains both color and bold formatting, the text wrapping breaks the color configuration. Only the first line is colored as expected.To Reproduce
Run the following code
Expected behavior
The text should retain the color formatting even after being wrapped to the next line.
Screenshots
As shown in the second column - the color configuration is broken when the text wrapping occurs.
Software (please complete the following information):
The text was updated successfully, but these errors were encountered: