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

Table layout breaks when a value is multiline #51

Closed
gairadzi opened this issue Mar 13, 2022 · 4 comments
Closed

Table layout breaks when a value is multiline #51

gairadzi opened this issue Mar 13, 2022 · 4 comments

Comments

@gairadzi
Copy link
Contributor

If the value of one the columns includes a newline character (and the string before it is smaller than the column's max width) the table layout will break.

This can be reproduced by changing the value in line 28 of examples/simplest/main.go to Electric\nhello

This is because the rune width of the first line is smaller than the max width, I believe the expected behavior should be to only show the first line appended by the dots (to indicate it includes further data).

@Evertras
Copy link
Owner

Initially addressed by #52 (linking here for tracking) but still missing one issue.

Turns out this still breaks in an edge case:

image

If the first line is exactly the max length, adding the ... character at the end makes it too long.

@Evertras
Copy link
Owner

Latest PR should fix this

@Evertras
Copy link
Owner

Released v0.8.4, let me know if this looks good to you and then feel free to close the issue. Thanks again for the contribution!

@gairadzi
Copy link
Contributor Author

Looks great, thanks!

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

No branches or pull requests

2 participants