mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Render Markdown links as clickable labels in supported terminals (#40471)
## What changed - Render web-link labels in cyan with an underline and hide the repeated destination in recognized terminals with hyperlink support. - Keep destinations visible for unknown terminals, multiplexers, non-terminal output, and empty labels so the URL remains usable. - Preserve OSC 8 link targets through prose and table wrapping, streaming updates, transcript clipping, and pager scrolling. ## Testing - Add coverage for terminal detection, label formatting and fallbacks, wrapped tables and prose, streaming parity, history output, and scrolled transcript rendering. GitOrigin-RevId: 4a09e41e349ba299022a9c00f0c25892d9aaefe3
This commit is contained in:
1 parent
c3d5e4418f
commit
bb8cada846
17 files changed
+614
-60
No files matched your search
@@ -3,6 +3,10 @@
|
||||
//! Layout code measures and wraps ordinary ratatui lines. Hyperlink annotations are applied only
|
||||
//! when text reaches a terminal buffer or scrollback writer so OSC 8 bytes never affect geometry.
|
||||
|
||||
mod paragraph;
|
||||
|
||||
pub(crate) use paragraph::HyperlinkParagraph;
|
||||
|
||||
use std::num::NonZeroU16;
|
||||
use std::ops::Range;
|
||||
|
||||
@@ -778,10 +782,7 @@ mod tests {
|
||||
);
|
||||
let mut buf = Buffer::empty(area);
|
||||
|
||||
Paragraph::new(Text::from(line.line.clone()))
|
||||
.wrap(Wrap { trim: false })
|
||||
.render(area, &mut buf);
|
||||
mark_buffer_hyperlinks(&mut buf, area, &[line], /*scroll_rows*/ 0);
|
||||
HyperlinkParagraph::new(&[line], Style::default()).render(area, &mut buf);
|
||||
|
||||
let linked_text = area
|
||||
.positions()
|
||||
@@ -819,11 +820,9 @@ mod tests {
|
||||
terminal
|
||||
.draw(|frame| {
|
||||
let buf = frame.buffer_mut();
|
||||
Paragraph::new(Text::from(visible_lines_ref(&lines)))
|
||||
.wrap(Wrap { trim: false })
|
||||
.scroll((/*vertical*/ 2, /*horizontal*/ 0))
|
||||
HyperlinkParagraph::new(&lines, Style::default())
|
||||
.scroll(/*rows*/ 2)
|
||||
.render(area, buf);
|
||||
mark_buffer_hyperlinks(buf, area, &lines, /*scroll_rows*/ 2);
|
||||
|
||||
let linked_text = area
|
||||
.positions()
|
||||
|
||||
Reference in new issue
Block a user