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

Invalid table column length when using hyperlinks #4

Closed
IonBazan opened this issue Jul 1, 2022 · 3 comments
Closed

Invalid table column length when using hyperlinks #4

IonBazan opened this issue Jul 1, 2022 · 3 comments

Comments

@IonBazan
Copy link

IonBazan commented Jul 1, 2022

Not sure if it is caused by this repository so please feel free to move or close this issue if needed.

When running symfony server:list, the length of Port column doesn't match the content length:
image

This is working fine when running with --no-ansi:
image

I believe it's caused by the length calculation including the http:/127.0.0.1:8000 Terminal Hyperlink embedded in the table content. Special formatting characters (like colours and hyperlinks) should be ignored when determining the content length for tables.

@tucksaun
Copy link
Member

tucksaun commented Jul 1, 2022

The issue is caused by the fact that the package used to format tables only account for the whole string size (see symfony-cli/symfony-cli#10 for more information).

IIRC there's nothing that terminal can do. The fix should be done in https://github.com/olekukonko/tablewriter (fix column size width computation) on in https://github.com/symfony-cli/symfony-cli (not use hyperlinks at all)

@tucksaun
Copy link
Member

See olekukonko/tablewriter#206 for the upstream fix.

Also, see symfony-cli/symfony-cli#224 for a way to "inject" the fix in the vendor while waiting for an upstream merge if you directly use this library.

@fabpot I believe this issue can now be closed;

@IonBazan
Copy link
Author

Amazing, thanks! Let's close it only after one of these PRs is merged.

@fabpot fabpot closed this as completed Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants