-
Notifications
You must be signed in to change notification settings - Fork 34
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
[BUG] Handle minimum table width for multi-column utf-8 characters #53
Comments
After a lot of consideration, this is an edge-case that's considered acceptable. This will need a lot of additional checks and it will most likely never happen. If it happens, it's easily fixable by adding a Constraint with the minimum length of 2 on this column. |
I would like to re-open this issue, as it seems to break more often that the edge case you mentioned: just take the Before using your lib, I manually handled this case (see pimalaya/himalaya#300 (comment)), I feel confident enough to propose a PR. Would you be interested in it? |
Hm. I think these are two different problems. The ticket is about single utf-8 chars that occupy multiple spaces inside a string that're inside of columns with a width of The issue you're showing is the other way around. It's about multiple utf-8 chars that're squashed into a single utf-8 char. This is a bit curious so I started to check out terminals. AlacrittyAlacritty seems to not be able to display variation selectors: As you can see, the selector isn't merged into the bike, which leads to a shift to the right. Otherwise this is perfectly fine and expected behavior. KittyKitt is able to display those chars, but it does some weird stuff: The bike char correctly occupies 2 spaces, but for some reason it still occupies as much space as the original sequences which is WeztermWezterm gets it right ConclusionFrom what I can observe, this isn't an issue with comfy-table but rather bugs, non-supported unicode sets and non-standardized drawing behaviours accross various terminal emulators and fonts. Regarding the panic, that should obviously not happen. I'll see whether I can reproduce the issue. |
I would probably be okay with a helper function or config flag inside of comfy-table that goes through everything and strips those chars. I really don't want to make this a default, as this won't be a problem for everyone and I'm certain that there'll be bug reports about those emojis not being properly displayed. I never expected to have this many issues with utf-8 -.-. |
Thank you for diving into the issue. The terminal results are really unexpected. The good news is that there is nothing to do from your side. The only issue I still cannot reproduce (and I'm not even sure it comes from |
I propose to close this issue, as it does not come from the lib. I will open another issue if we find the reason of the panic. |
Sounds good to me :) Thanks! |
This is a follow-up issue to #44.
By default, if there's not enough space and dynamic mode is active, comfy-table falls back to a column with minimum-width of
1
.However, if there are multi-column characters in the text, the format will break as the character doesn't fit into the line.
Example:
This is a super rare edge-case and this will need quite a bit of special logic to be properly handled. This includes iterating through all characters of a column.
I'm not sure if it's worth doing it. However, it's probably better to do so, even if it's just for the sake of consistency and correctness.
This behavior will also show up if the user enforces a width of
1
for a column, but this is something we won't handle!The text was updated successfully, but these errors were encountered: