mirror of
https://github.com/openai/codex.git
synced 2026-11-08 20:40:33 +00:00
Fix live stream reflow at the allocated conversation width (#58927)
## Why Streaming answers and plans need to wrap to the conversation's allocated width, which can differ from the terminal width. Resizing while reading earlier output should not report new activity unless new output has arrived. ## What changed Reflow live streams when preparing the owned conversation layout, using its allocated width. Update the observed live revision after presentation-only reflow so it does not trigger `New activity`, while preserving notifications for unseen output. ## Testing Add regression coverage for streaming answer and plan tables across width changes, including a narrow-layout snapshot, preservation of the reading position, and activity notifications when new output arrives before a resize. GitOrigin-RevId: a9831c5a1a5ffb7477e7868d4ecca430d6ee50f3
This commit is contained in:
@@ -5,6 +5,16 @@ use std::ops::Range;
|
||||
use super::*;
|
||||
|
||||
impl TranscriptView {
|
||||
/// Rebuild the layout of an observed revision without counting the reflow as new output.
|
||||
pub(crate) fn rebind_observed_live_revision(&mut self, observed: u64, updated: u64) {
|
||||
if let Some((_, key)) = &mut self.live_key
|
||||
&& key.revision == observed
|
||||
{
|
||||
key.revision = updated;
|
||||
key.cacheable = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Refresh unseen activity before either footer measurement or transcript painting.
|
||||
pub(crate) fn sync_history_tail(&mut self, cells: &[Arc<dyn HistoryCell>]) {
|
||||
let tail = cells.last().map(EntryKey::cell);
|
||||
@@ -148,14 +158,11 @@ impl TranscriptView {
|
||||
if self.last_tail == Some(tail_key) {
|
||||
self.last_tail = preceding.last().map(EntryKey::cell);
|
||||
}
|
||||
let following = self.is_following();
|
||||
if let Some((_, key)) = &mut self.live_key {
|
||||
if !following && key.revision != previous_revision {
|
||||
if let Some((_, key)) = self.live_key {
|
||||
if !self.is_following() && key.revision != previous_revision {
|
||||
self.unseen_activity = true;
|
||||
}
|
||||
key.revision = hydrated_revision;
|
||||
// Force fresh lines even if the next draw receives this exact hydrated revision.
|
||||
key.cacheable = false;
|
||||
self.rebind_observed_live_revision(key.revision, hydrated_revision);
|
||||
}
|
||||
if self.snapshot().is_some() {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user