mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Add sidebar image previews and present generated images after answers (#61919)
## What changed - Open PNG, JPEG, GIF, and WebP file links as sidebar image previews, fitted to the available space with format and dimension labels. Show a fallback when terminal graphics are unavailable, and preserve text previews for files such as Git LFS pointers. - In the owned transcript, place completed, saved image results after the assistant's answer, with larger, left-aligned previews and a clickable `Generated image` label. Preserve this ordering during replay and history pagination, including interrupted turns. - Reuse native Kitty image IDs and move existing placements without retransmitting their pixels. Probe Kitty graphics support in `herdr` before enabling previews. ## Testing Add regression coverage for sidebar preview fallbacks, generated-image ordering, pagination and search, preview layout, Kitty placement reuse, and graphics probe replies interleaved with pasted input. GitOrigin-RevId: 22d8aa2724f17bfa7f8280a2d11d4a7e2cb66728
This commit is contained in:
@@ -439,8 +439,14 @@ impl TranscriptView {
|
||||
if skip >= rows.len() {
|
||||
continue;
|
||||
}
|
||||
let image_indent = if visible.layout.image_left_aligned {
|
||||
// Match the two-column prefix the assistant's Markdown uses.
|
||||
2
|
||||
} else {
|
||||
self.area.width.saturating_sub(image.columns) / 2
|
||||
};
|
||||
let area = Rect::new(
|
||||
self.area.x + self.area.width.saturating_sub(image.columns) / 2,
|
||||
self.area.x + image_indent,
|
||||
entry_y + skip as u16,
|
||||
image.columns,
|
||||
(rows.len() - skip) as u16,
|
||||
@@ -450,6 +456,7 @@ impl TranscriptView {
|
||||
area,
|
||||
first_row: visible.row.saturating_sub(image_start),
|
||||
file: None,
|
||||
terminal_id: None,
|
||||
});
|
||||
}
|
||||
placements
|
||||
|
||||
Reference in New Issue
Block a user