commit 6a20e18091ae8cd2d9e5e5c4040617ff06c3b51d
parent e6a8450cfd521e2e085b933498e197248d33a520
Author: William Casarin <jb55@jb55.com>
Date: Thu, 19 Feb 2026 11:02:46 -0800
dave: expand markdown table columns to fill available width
Column::auto() starts columns at minimal width, making tables
look cramped. Set a minimum column width based on available space
so tables fill the area evenly while still auto-expanding for
wider content.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/crates/notedeck_dave/src/ui/markdown_ui.rs b/crates/notedeck_dave/src/ui/markdown_ui.rs
@@ -500,9 +500,12 @@ fn render_table(headers: &[Span], rows: &[Vec<Span>], theme: &MdTheme, buffer: &
// Use first header's byte offset as id_salt so multiple tables don't clash
let salt = headers.first().map_or(0, |h| h.start);
+ let available_width = ui.available_width();
+ let min_col_width = (available_width / num_cols as f32).max(40.0);
+
let mut builder = TableBuilder::new(ui).id_salt(salt).vscroll(false);
for _ in 0..num_cols {
- builder = builder.column(Column::auto().resizable(true));
+ builder = builder.column(Column::auto().at_least(min_col_width).resizable(true));
}
let header_bg = theme.code_bg;