-
Notifications
You must be signed in to change notification settings - Fork 43
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
Colors truncate column width #69
Comments
colors are tricky =\ The problem is, we need to do two things: count the string length, and truncate long strings. The string length calculator is naively counting nonprinting characters, and the truncation naively cuts off any nonprinting characters after the truncation point. Honestly it's going to be a while before I would get to this, but if you want to poke around here's where to start: truncation - https://github.com/arches/table_print/blob/master/lib/table_print/formatter.rb#L33-L40 You'll note in the width detection there's a multibyte approach and a naive approach - multibyte counting is much slower so it's off by default. |
👍 |
👍 #70 |
It seems whenever I use colors, it truncates the column width and causes weird readability issues:
For the following example I used: https://github.com/janlelis/paint
Example:
As you (might) be able to see, column e and f resized to four characters, they were the ones that I colorized.
When I try to colorize C and D, it gets even weirder, removing some columns and inserting special characters.
I assume it has something to do with the way table_print encodes the special table characters, but not sure.
The text was updated successfully, but these errors were encountered: