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,7 @@
|
||||
use super::transcript::ActiveCellLayoutCache;
|
||||
use super::transcript::ActiveCellLayoutCacheKey;
|
||||
use super::*;
|
||||
use crate::terminal_hyperlinks::HyperlinkParagraph;
|
||||
use std::cell::Cell;
|
||||
|
||||
impl ChatWidget {
|
||||
@@ -112,8 +113,8 @@ struct PersistentActiveCellLayout<'a> {
|
||||
impl Renderable for TranscriptAreaRenderable<'_> {
|
||||
fn render(&self, area: Rect, buf: &mut Buffer) {
|
||||
let area = self.child_area(area);
|
||||
let lines = self.child.display_lines(area.width);
|
||||
let paragraph = Paragraph::new(Text::from(lines)).wrap(Wrap { trim: false });
|
||||
let lines = self.child.display_hyperlink_lines(area.width);
|
||||
let paragraph = HyperlinkParagraph::new(&lines, Style::default());
|
||||
let y = if area.height == 0 {
|
||||
0
|
||||
} else {
|
||||
@@ -133,7 +134,7 @@ impl Renderable for TranscriptAreaRenderable<'_> {
|
||||
u16::try_from(overflow).unwrap_or(u16::MAX)
|
||||
};
|
||||
Clear.render(area, buf);
|
||||
paragraph.scroll((y, 0)).render(area, buf);
|
||||
paragraph.scroll(y).render(area, buf);
|
||||
}
|
||||
|
||||
fn desired_height(&self, width: u16) -> u16 {
|
||||
|
||||
Reference in new issue
Block a user