Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

chore(deps): bump termimad to 0.35.1, drop ragged-table panic workaround (#3422)

Worktrunk Botc3c07a4e5b01
diff --git a/Cargo.lock b/Cargo.lock
index 99e9cb8f0..a5d5c6f25 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1895,9 +1895,9 @@ dependencies = [
[[package]]
name = "minimad"
-version = "0.14.0"
+version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df8b688969b16915f3ecadc7829d5b7779dee4977e503f767f34136803d5c06f"
+checksum = "de632ee829aec3a874d18a4192eae64a0460b3a45c54ed556b334f6fe5a1d62f"
dependencies = [
"once_cell",
]
@@ -3340,9 +3340,9 @@ dependencies = [
[[package]]
name = "termimad"
-version = "0.34.1"
+version = "0.35.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "889a9370996b74cf46016ce35b96c248a9ac36d69aab1d112b3e09bc33affa49"
+checksum = "d53d4b1294b87e81925b7ae7f8f4d000376e3a5b3349d978429665428a793fcb"
dependencies = [
"coolor",
"crokey",
diff --git a/Cargo.toml b/Cargo.toml
index 2759914ce..2c48bf574 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -220,7 +220,7 @@ which = "8.0.2"
# Cross-platform path canonicalization that avoids Windows verbatim paths (\\?\)
# which external tools like git cannot handle. On Unix, it's a no-op wrapper.
dunce = "1.0"
-termimad = { version = "0.34.1", optional = true }
+termimad = { version = "0.35.1", optional = true }
urlencoding = "2.1"
regex = "1.12.3"
ignore = "0.4"
diff --git a/src/md_help.rs b/src/md_help.rs
index d3846e46a..a87fefeac 100644
--- a/src/md_help.rs
+++ b/src/md_help.rs
@@ -302,19 +302,7 @@ fn render_table_with_termimad(lines: &[&str], indent: &str, max_width: Option<us
.unwrap_or(DEFAULT_HELP_WIDTH);
let skin = help_table_skin();
- // termimad 0.34.1 panics with an out-of-bounds index on a *ragged* table —
- // a row with more cells than the header — when it's rendered at a width too
- // narrow to fit the widest row. Its column fitter (`Table::fix_columns`,
- // termimad's src/tbl.rs) takes an error path that skips padding the short
- // rows, then indexes past them. PR-comment markdown is untrusted and can
- // contain such a table (issue #3407), and the picker renders comment bodies
- // through here on a rayon worker — an escaped panic aborts the whole
- // process. Contain it and fall back to the plain preprocessed lines so the
- // pane still shows the table's text rather than crashing `wt switch`.
- let rendered = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
- skin.text(&markdown, Some(width)).to_string()
- }))
- .unwrap_or_else(|_| processed.join("\n"));
+ let rendered = skin.text(&markdown, Some(width)).to_string();
// Add indent to each line
if indent.is_empty() {
@@ -739,7 +727,7 @@ mod tests {
#[test]
fn test_render_markdown_in_help_table() {
- let result = render_markdown_in_help("| A | B |\n| - | - |\n| 1 | 2 |");
+ let result = render_markdown_in_help("| A | B |\n| --- | --- |\n| 1 | 2 |");
assert_snapshot!(result, @"
A B
─── ───
@@ -870,35 +858,28 @@ mod tests {
#[test]
fn test_render_table_ragged_narrow_does_not_panic() {
- // Regression for #3407. termimad 0.34.1 panics with an out-of-bounds
+ // Regression for #3407. termimad <= 0.34.1 panicked with an out-of-bounds
// index when a *ragged* table — a row with more cells than the header —
- // is rendered at a narrow width: its column fitter (`Table::fix_columns`
- // in termimad's src/tbl.rs) takes an error path that skips cell padding,
- // then indexes past the shorter row. PR-comment markdown is untrusted and
+ // was rendered at a narrow width: its column fitter (`Table::fix_columns`
+ // in termimad's src/tbl.rs) took an error path that skipped cell padding,
+ // then indexed past the shorter row. PR-comment markdown is untrusted and
// can contain such a table, and the picker renders comment bodies through
- // here, so this used to abort `wt switch`. The render must degrade to
- // plain text instead of crashing.
+ // here, so this used to abort `wt switch`. Fixed upstream in termimad
+ // 0.35.1 (Canop/termimad#77); this guards against a regression or an
+ // accidental downgrade — the render must complete rather than panicking.
let lines = vec![
"| Key | Value |",
"| --- | --- |",
"| alpha | beta | gamma | delta | epsilon | zeta |",
];
+ // The bug manifested as an out-of-bounds panic *during* rendering in the
+ // narrow-width band (16/20/24). termimad wraps cells hard and drops
+ // columns to fit width 20, so we don't assert on specific cell text —
+ // reaching this line at all is the proof the panic is gone.
let result = render_table(&lines, Some(20));
- let plain = ansi_str::AnsiStr::ansi_strip(&result);
- // Assert on something only the fallback produces, so the test keeps
- // covering `catch_unwind` even if a future termimad release stops
- // panicking on this input. The fallback returns the preprocessed lines
- // verbatim, keeping the literal `|` delimiters; a successful termimad
- // render replaces them with box-drawing borders (`│`) and contains no
- // literal `|`. Cell-text presence alone can't tell the two apart.
assert!(
- plain.contains('|'),
- "expected the plain-text fallback (literal `|` delimiters), \
- not a termimad render: {plain}"
- );
- assert!(
- plain.contains("alpha") && plain.contains("zeta"),
- "fallback should still surface the table's cell text: {plain}"
+ !result.is_empty(),
+ "render should complete and produce output"
);
}