Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Render Markdown web links as labels in Rex (#53725)

Benjamin Carlsson72ad8747e926
diff --git a/codex-rs/tui/src/markdown_render/web_links.rs b/codex-rs/tui/src/markdown_render/web_links.rs
index 0ed41d9f3f..773ff4ca51 100644
--- a/codex-rs/tui/src/markdown_render/web_links.rs
+++ b/codex-rs/tui/src/markdown_render/web_links.rs
@@ -69,6 +69,13 @@ impl WebLinkDisplay {
{
return Self::WithDestination;
}
+ if terminal
+ .term_program
+ .as_deref()
+ .is_some_and(|program| program.eq_ignore_ascii_case("rex"))
+ {
+ return Self::LabelOnly;
+ }
match terminal.name {
TerminalName::Ghostty
| TerminalName::Iterm2
diff --git a/codex-rs/tui/src/markdown_render/web_links_tests.rs b/codex-rs/tui/src/markdown_render/web_links_tests.rs
index 7869cc2715..38eba10d2e 100644
--- a/codex-rs/tui/src/markdown_render/web_links_tests.rs
+++ b/codex-rs/tui/src/markdown_render/web_links_tests.rs
@@ -143,6 +143,21 @@ fn supporting_terminals_render_only_the_styled_label_and_keep_its_target() {
}
}
+#[test]
+fn rex_renders_only_the_label() {
+ let mut rex = terminal(TerminalName::Unknown);
+ rex.term_program = Some("rex".to_string());
+ let markdown = "[label](https://example.com)";
+ assert_eq!(
+ render(
+ markdown,
+ /*width*/ 80,
+ WebLinkDisplay::for_terminal(&rex, /*term*/ None),
+ ),
+ render(markdown, /*width*/ 80, WebLinkDisplay::LabelOnly),
+ );
+}
+
#[test]
fn unknown_terminals_and_multiplexers_keep_visible_destinations() {
let mut tmux = terminal(TerminalName::Ghostty);