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

Tab char and border alignment issue with tables #1608

Open
ErrorEater opened this issue Aug 12, 2024 · 1 comment
Open

Tab char and border alignment issue with tables #1608

ErrorEater opened this issue Aug 12, 2024 · 1 comment
Labels
bug Something isn't working needs triage ⭐ top bug Top bug.

Comments

@ErrorEater
Copy link

Information

  • OS: Windows
  • Version: 0.49.1
  • Terminal: Windows Terminal (CMD)

Tab char is probably counted as 1 char length when determining the column length of a table and that in turn pushes table borders to the right as seen on the buggy output (there is a tab char between amount and symbol).
On the correct output there are 4 spaces instead of a tab char.

Fix suggestion:

  1. Replace tab chars with 4 spaces of the input text. (Fast fix)
  2. Calculate the tab positions (1 TAB = 8 spaces) and spacing they create to determine the correct length of the text.

Buggy output:

┌────────────────────────────────────────────┬─────────────────────┬─────────────────────┬──────────────┬────────────────────────────────────────────┬─────────────────────┐
│ Token                                      │ AmountTokenDesired  │ AmountTokenMin      │ AmountETHMin │ To                                         │ Deadline            │
├────────────────────────────────────────────┼─────────────────────┼─────────────────────┼──────────────┼────────────────────────────────────────────┼─────────────────────┤
│ 0x1140975ba14eBfE7497585E68fcE32A0F0EA50cC │ 950,000,000,000  BYDEN │ 950,000,000,000 BYDEN │ 05.98   WETH     │ 0x268A557bdC55a79435A8901e34A61E60FD8Be904 │ 2024-08-12 14:01:30 │
└────────────────────────────────────────────┴─────────────────────┴─────────────────────┴──────────────┴────────────────────────────────────────────┴─────────────────────┘

Correct output:

┌────────────────────────────────────────────┬───────────────────────────┬───────────────────────────┬──────────────┬────────────────────────────────────────────┬─────────────────────┐
│ Token                                      │ AmountTokenDesired        │ AmountTokenMin            │ AmountETHMin │ To                                         │ Deadline            │
├────────────────────────────────────────────┼───────────────────────────┼───────────────────────────┼──────────────┼────────────────────────────────────────────┼─────────────────────┤
│ 0xAed3ff77040F12A6cb59062FAb80BD036873d0F7 │ 850,000,000,000    ??wCAT │ 850,000,000,000    ??wCAT │ 03.5    WETH │ 0xDa1266Cc055eC7fA0529f447B40B88f3c1c494Df │ 2024-08-12 14:12:46 │
└────────────────────────────────────────────┴───────────────────────────┴───────────────────────────┴──────────────┴────────────────────────────────────────────┴─────────────────────┘
@ErrorEater ErrorEater added bug Something isn't working needs triage labels Aug 12, 2024
@ErrorEater
Copy link
Author

I just noticed that it's not just tab char causing issues, other non printable chars also cause alignment issues.

┌────────────────────────────────────────────┬──────────┬─────────────┐
│ Token                                      │ Metadata │ TotalSupply │
├────────────────────────────────────────────┼──────────┼─────────────┤
│ 0x92642D0Ad820333cc2C4A22E7F6E3c57091aAc34 │          │             │
│ ┌───────┬────────┬──────────┐              │          │             │
│ │ Name  │ Symbol │ Decimals │              │          │             │
│ ├───────┼────────┼──────────┤              │          │             │
│ │ WHY? │ WHY    │ 18       │              │          │             │ 
│ └───────┴────────┴──────────┘              │          │             │
│ 870,000,000,000 WHY                        │          │             │
└────────────────────────────────────────────┴──────────┴─────────────┘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage ⭐ top bug Top bug.
Projects
Status: Todo 🕑
Development

No branches or pull requests

1 participant