mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
## What changed - Make double `Esc` enter compact prompt browsing in the owned transcript view and inline overlay. Use left/right arrows to select prompts, up/down arrows to scroll, `Ctrl+T` to toggle details, and `Enter` to rewind and edit. `Esc` cancels browsing and restores the original reading position and presentation. - Add a responsive browsing footer, a pinned prompt header for answer context, and contextual composer tips that respect `show_tooltips` and configured shortcuts. - Load older history as prompt navigation needs it, preserve the selected prompt across pagination, and resolve rewind requests by cell identity. Reject remote prompt restoration when it contains local image paths or command syntax. - Bound initial owned-transcript history loading to a budget of three screenfuls plus an item scan limit, independently of terminal scrollback settings. ## Testing Add regression tests and snapshots for browsing, rewind, cancellation after resize and pagination, custom key bindings, search and selection precedence, offline input, prompt headers, composer tips, and history hydration. GitOrigin-RevId: 1d9ef7b627f47c3def43e7aee7148b5909f6d357
47 lines
1.6 KiB
Rust
47 lines
1.6 KiB
Rust
//! Save a browsing origin independently of the compact/detailed position pair.
|
|
//! Retained cell identities and source offsets survive pagination and rewrapping.
|
|
|
|
use super::*;
|
|
|
|
pub(crate) struct TranscriptBookmark {
|
|
position: Position,
|
|
saved_position: Option<Position>,
|
|
suppressed_prompt_header: Option<prompt_header::SuppressedHeader>,
|
|
detailed: bool,
|
|
mode: HistoryRenderMode,
|
|
snapshot: Option<ViewSnapshot>,
|
|
last_tail: Option<EntryKey>,
|
|
unseen_activity: bool,
|
|
}
|
|
|
|
impl TranscriptView {
|
|
pub(crate) fn bookmark(&mut self, cells: &[Arc<dyn HistoryCell>]) -> TranscriptBookmark {
|
|
TranscriptBookmark {
|
|
position: self.position,
|
|
saved_position: self.saved_position,
|
|
suppressed_prompt_header: self.suppressed_prompt_header,
|
|
detailed: self.detailed,
|
|
mode: self.mode,
|
|
snapshot: (!self.is_following()).then(|| self.capture_snapshot(cells)),
|
|
last_tail: self.last_tail,
|
|
unseen_activity: self.unseen_activity,
|
|
}
|
|
}
|
|
|
|
pub(crate) fn restore_bookmark(&mut self, bookmark: TranscriptBookmark) {
|
|
self.jump_to_latest();
|
|
self.set_presentation(bookmark.detailed, bookmark.mode);
|
|
self.position = bookmark.position;
|
|
self.saved_position = bookmark.saved_position;
|
|
self.suppressed_prompt_header = bookmark.suppressed_prompt_header;
|
|
self.held_reading = bookmark.snapshot;
|
|
self.rewrap_snapshot(self.area.width);
|
|
self.highlight = None;
|
|
self.unseen_activity = bookmark.unseen_activity || self.last_tail != bookmark.last_tail;
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "bookmark_tests.rs"]
|
|
mod tests;
|