commit bdd338b7b8f463c2acbc6ea5fa2ad02e70337b34
parent 259f12b6292bf3793ba480207e49427559bb2258
Author: William Casarin <jb55@jb55.com>
Date: Mon, 16 Feb 2026 13:12:04 -0800
markdown_ui: fix multiple tables clashing by adding id_salt
TableBuilder requires unique IDs when multiple tables exist in the
same Ui. Without id_salt, all tables shared the same auto-generated
ID, corrupting each other's column width state and breaking layout.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/crates/notedeck_dave/src/ui/markdown_ui.rs b/crates/notedeck_dave/src/ui/markdown_ui.rs
@@ -271,7 +271,11 @@ fn render_table(headers: &[Span], rows: &[Vec<Span>], theme: &MdTheme, buffer: &
let cell_padding = egui::Margin::symmetric(8, 4);
- let mut builder = TableBuilder::new(ui).vscroll(false);
+ // 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 mut builder = TableBuilder::new(ui)
+ .id_salt(salt)
+ .vscroll(false);
for _ in 0..num_cols {
builder = builder.column(Column::auto().resizable(true));
}