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

Double-width characters spoil column alignment #1520

Open
smammy opened this issue Mar 4, 2024 · 4 comments
Open

Double-width characters spoil column alignment #1520

smammy opened this issue Mar 4, 2024 · 4 comments

Comments

@smammy
Copy link

smammy commented Mar 4, 2024

Test case:

printf '%s\t%s\n' \
    sample width \
    $'\uFF21\uFF22\uFF23\uFF24\uFF25' double \
    ABCDE single \
> example.tsv
mlr --from example.tsv --t2p cat

Expected result:
image

Actual result:
image

References:

@johnkerl
Copy link
Owner

johnkerl commented Mar 4, 2024

Perhaps #379 and this would have the same fix ...

@smammy
Copy link
Author

smammy commented Mar 5, 2024

Perhaps #379 and this would have the same fix ...

I bet it would!

@smammy
Copy link
Author

smammy commented Mar 5, 2024

util-linux' column command uses wcwidth to calculate number of columns the character will use. Found StringWidth in uniseg; maybe that would be useful?

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