Preserve clickable URLs in TUI approval headers (#51439)

## What changed

Render command, permission, patch, and MCP elicitation approval headers with `HyperlinkText`, which annotates web URLs and preserves their full destinations across wrapping and clipping.

## Testing

Add a regression test covering wrapped URL destinations in all four header types, plus a snapshot of the wrapped command approval header.

GitOrigin-RevId: 7f6b79484c9297cd03514da2d6805b0d239fee63
This commit is contained in:
Charlie Marsh
2026-10-06 18:16:18 +00:00
committed by copyberry
parent 8e23d1836f
commit bc3ebcb77d
5 changed files with 92 additions and 6 deletions
@@ -3,11 +3,10 @@
use super::approval_overlay::ApplyPatchApprovalRequest;
use crate::diff_model::FileChange;
use crate::render::renderable::Renderable;
use crate::terminal_hyperlinks::HyperlinkText;
use codex_utils_path_uri::LegacyAppPathString;
use ratatui::style::Stylize;
use ratatui::text::Line;
use ratatui::widgets::Paragraph;
use ratatui::widgets::Wrap;
pub(super) fn build_header(request: &ApplyPatchApprovalRequest) -> Box<dyn Renderable> {
let mut header = Vec::new();
@@ -70,5 +69,5 @@ pub(super) fn build_header(request: &ApplyPatchApprovalRequest) -> Box<dyn Rende
destination.bold(),
]));
}
Box::new(Paragraph::new(header).wrap(Wrap { trim: false }))
Box::new(HyperlinkText::new(header))
}