From 38664bc2fbc122a1fd452550acccc3ff1ed92c2e Mon Sep 17 00:00:00 2001 From: Felipe Coury Date: Mon, 16 Feb 2026 23:00:01 -0300 Subject: [PATCH] fix(tui): keep link suffixes inside table cells --- codex-rs/tui/src/markdown_render_tests.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/codex-rs/tui/src/markdown_render_tests.rs b/codex-rs/tui/src/markdown_render_tests.rs index b6425405f4..818da5b210 100644 --- a/codex-rs/tui/src/markdown_render_tests.rs +++ b/codex-rs/tui/src/markdown_render_tests.rs @@ -1475,6 +1475,28 @@ fn table_pipe_fallback_escapes_literal_pipes_in_cell_content() { assert!(lines.iter().any(|line| line.contains("a \\| b"))); } +#[test] +fn table_link_keeps_url_suffix_inside_cell() { + let md = "| Site |\n|---|\n| [OpenAI](https://openai.com) |\n"; + let text = render_markdown_text(md); + let lines: Vec = text + .lines + .iter() + .map(|line| line.spans.iter().map(|span| span.content.clone()).collect()) + .collect(); + + assert!( + lines + .iter() + .any(|line| line.contains("OpenAI (https://openai.com)")), + "expected link suffix inside table cell: {lines:?}" + ); + assert!( + !lines.iter().any(|line| line.trim() == "(https://openai.com)"), + "did not expect stray url suffix line outside table: {lines:?}" + ); +} + #[test] fn table_keeps_sparse_rows_with_empty_trailing_cells() { let md = "| A | B | C |\n|---|---|---|\n| a | | |\n";