Skip to content

Tab char and border alignment issue with tables #1608

@ErrorEater

Description

@ErrorEater

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 │
└────────────────────────────────────────────┴───────────────────────────┴───────────────────────────┴──────────────┴────────────────────────────────────────────┴─────────────────────┘

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo 🕑

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions