mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
Render Markdown web links as labels in Rex (#53725)
## What changed Select label-only web link rendering when `TERM_PROGRAM` is `rex`, matched case-insensitively. Preserve the existing visible-destination fallback for multiplexers and `dumb`, `screen`, or `tmux` terminal modes. ## Testing Add a regression test verifying that Rex renders `[label](https://example.com)` with the label-only policy. GitOrigin-RevId: 615ca6186d84fc17cef9286e75848877b542b6ab
This commit is contained in:
committed by
copyberry
parent
703d253ed6
commit
72ad8747e9
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user