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";