mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
## What changed Replace generic output disclosure labels with counts such as `+ 5 lines (ctrl+t to expand)` for compact command activity, both live and in history. Count retained output lines hidden or clipped by the preview, excluding output discarded by storage limits. Use the configured `open_transcript` shortcut and omit the hint when it does not fit or the action is unbound. Invalidate cached layouts when keybindings change. Keep generic `Show details` labels for other hidden details and keep disclosure controls outside copyable and searchable text. ## Testing Add regression tests for live/history consistency, remapped and disabled shortcuts, and exclusion of hints from source text. Add snapshot coverage for fully visible output, hidden and clipped lines, command-only details, and storage-truncated output. GitOrigin-RevId: c468be9b88b69dc3ca1abdb6b7be023244d32a57
66 lines
2.4 KiB
Rust
66 lines
2.4 KiB
Rust
//! Expose live activity identity and local detail rendering to the owned transcript.
|
|
//! Canonical cells retain all available data; presentation does not modify tool execution.
|
|
|
|
use super::*;
|
|
use crate::transcript_view::ActivityTranscriptLines;
|
|
|
|
impl ChatWidget {
|
|
pub(crate) fn active_activity_ids(&self) -> Vec<String> {
|
|
self.transcript
|
|
.active_cell
|
|
.as_ref()
|
|
.map_or_else(Vec::new, |cell| cell.activity_ids())
|
|
}
|
|
|
|
/// Render only the chosen activity presentation, before any auxiliary live text.
|
|
pub(crate) fn active_cell_owned_transcript_lines(
|
|
&self,
|
|
width: u16,
|
|
expanded: bool,
|
|
) -> Option<ActivityTranscriptLines> {
|
|
let active = self.transcript.active_cell.as_deref();
|
|
let mode = self.history_render_mode();
|
|
let render_compact = |cell: &dyn HistoryCell, width| {
|
|
if cell.as_any().is::<history_cell::SessionInfoCell>() {
|
|
history_cell::fullscreen_session_lines(cell, width, /*detailed*/ false, mode)
|
|
} else if mode == HistoryRenderMode::Raw {
|
|
cell.display_hyperlink_lines_for_mode(width, mode)
|
|
} else {
|
|
cell.compact_hyperlink_lines(width)
|
|
}
|
|
};
|
|
let has_activity = mode == HistoryRenderMode::Rich
|
|
&& active.is_some_and(|cell| !cell.activity_ids().is_empty());
|
|
let activity = active.map_or_else(Vec::new, |cell| {
|
|
if expanded && has_activity {
|
|
cell.expanded_hyperlink_lines(width)
|
|
} else {
|
|
render_compact(cell, width)
|
|
}
|
|
});
|
|
let disclosure = active
|
|
.filter(|_| has_activity)
|
|
.and_then(|cell| cell.activity_disclosure(width));
|
|
let mut auxiliary = self
|
|
.active_cell_hyperlink_lines_with(width, |cell, width| {
|
|
if active.is_some_and(|active| std::ptr::eq(active, cell)) {
|
|
Vec::new()
|
|
} else {
|
|
render_compact(cell, width)
|
|
}
|
|
})
|
|
.unwrap_or_default();
|
|
if activity.is_empty() && auxiliary.is_empty() {
|
|
return None;
|
|
}
|
|
if !activity.is_empty() && !auxiliary.is_empty() {
|
|
auxiliary.insert(/*index*/ 0, HyperlinkLine::from(""));
|
|
}
|
|
Some(ActivityTranscriptLines {
|
|
activity,
|
|
auxiliary,
|
|
disclosure,
|
|
})
|
|
}
|
|
}
|