This commit is contained in:
2026-02-14 15:54:31 -08:00
parent ce2f28cc50
commit ae4880b164
7 changed files with 215 additions and 22 deletions

View File

@@ -70,6 +70,15 @@ def get_result_table_row_style(row_index: int) -> str:
return f"{text_color} on {bg_color}"
def apply_result_table_layout(table: Any) -> None:
"""Apply compact, flush column layout options to a Rich table."""
table.padding = (0, 1)
if hasattr(table, "pad_edge"):
table.pad_edge = False
if hasattr(table, "collapse_padding"):
table.collapse_padding = True
def _sanitize_cell_text(value: Any) -> str:
"""Coerce to a single-line, tab-free string suitable for terminal display."""
if value is None:
@@ -1374,6 +1383,9 @@ class Table:
empty,
title=Text(str(self.title), style=RESULT_TABLE_HEADER_STYLE),
border_style=RESULT_TABLE_BORDER_STYLE,
padding=(0, 0),
expand=False,
style="on #ffffff",
)
if self.title
else empty
@@ -1391,10 +1403,14 @@ class Table:
show_header=True,
header_style=RESULT_TABLE_HEADER_STYLE,
border_style=RESULT_TABLE_BORDER_STYLE,
box=SIMPLE,
expand=True,
box=None,
expand=False,
show_lines=False,
padding=(0, 1),
pad_edge=False,
collapse_padding=True,
)
apply_result_table_layout(table)
if not self.interactive:
table.add_column("#", justify="right", no_wrap=True)
@@ -1410,6 +1426,8 @@ class Table:
header = header_by_key.get(name, str(name).upper())
if name.lower() == "ext":
table.add_column(header, no_wrap=True)
elif name.lower() == "tag":
table.add_column(header, overflow="fold")
else:
table.add_column(header)
@@ -1430,6 +1448,9 @@ class Table:
renderable,
title=Text(str(self.title), style=RESULT_TABLE_HEADER_STYLE),
border_style=RESULT_TABLE_BORDER_STYLE,
padding=(0, 0),
expand=False,
style="on #ffffff",
)
if self.title
else renderable