[BUG] Table padding is miscalculated in first column
- [x] I've checked docs and closed issues for possible solutions.
- [x] I can't find my issue in the FAQ.
Table padding is miscalculated in first column
I'm using a table for layout, but the first column has too much padding between it and the second column. When I investigated, I found that adjusting the padding also adjusts the margin of error, meaning that it's basically putting in double the requested amount of padding, but only for the divider between the first and second columns.
Minimum reproduceable code
from rich import print
from rich.table import Table
table = Table.grid(padding=(0, 1))
for _ in range(3):
table.add_column(width=3)
for row in range(3):
table.add_row(*["a" * 3 for _ in range(3)])
print(table)
Platform Terminal: Windows Terminal (the new one from the Windows Store, not cmd.exe nor powershell.exe) Environment: WSL2 on Windows 10 OS: (in WSL2) Ubuntu 24.04 Rich version: 14.2.0
Diagnostic Output
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface. │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=194 ColorSystem.EIGHT_BIT> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ color_system = '256' │
│ encoding = 'utf-8' │
│ file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│ height = 49 │
│ is_alt_screen = False │
│ is_dumb_terminal = False │
│ is_interactive = True │
│ is_jupyter = False │
│ is_terminal = True │
│ legacy_windows = False │
│ no_color = False │
│ options = ConsoleOptions( │
│ size=ConsoleDimensions(width=194, height=49), │
│ legacy_windows=False, │
│ min_width=1, │
│ max_width=194, │
│ is_terminal=True, │
│ encoding='utf-8', │
│ max_height=49, │
│ justify=None, │
│ overflow=None, │
│ no_wrap=False, │
│ highlight=None, │
│ markup=None, │
│ height=None │
│ ) │
│ quiet = False │
│ record = False │
│ safe_box = True │
│ size = ConsoleDimensions(width=194, height=49) │
│ soft_wrap = False │
│ stderr = False │
│ style = None │
│ tab_size = 8 │
│ width = 194 │
╰──────────────────────────────────────────────────────────────────────────────────╯
╭─── <class 'rich._windows.WindowsConsoleFeatures'> ────╮
│ Windows features available. │
│ │
│ ╭───────────────────────────────────────────────────╮ │
│ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
│ ╰───────────────────────────────────────────────────╯ │
│ │
│ truecolor = False │
│ vt = False │
╰───────────────────────────────────────────────────────╯
╭────── Environment Variables ───────╮
│ { │
│ 'CLICOLOR': '1', │
│ 'COLORTERM': None, │
│ 'COLUMNS': None, │
│ 'JPY_PARENT_PID': None, │
│ 'JUPYTER_COLUMNS': None, │
│ 'JUPYTER_LINES': None, │
│ 'LINES': None, │
│ 'NO_COLOR': None, │
│ 'TERM_PROGRAM': None, │
│ 'TERM': 'xterm-256color', │
│ 'TTY_COMPATIBLE': None, │
│ 'TTY_INTERACTIVE': None, │
│ 'VSCODE_VERBOSE_LOGGING': None │
│ } │
╰────────────────────────────────────╯
platform="Linux"
❯ pip freeze | grep rich
rich==14.2.0
Thank you for your issue. Give us a little time to review it.
PS. You might want to check the FAQ if you haven't done so already.
Rich was created by Will McGugan. Consider sponsoring Will's work on Rich.
This is an automated reply, generated by FAQtory