mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
Keep streamed TUI answers intact when notices interrupt them (#63194)
## Why A warning or paste error can break the trailing run of streamed answer fragments. Finalizing only that run can leave part of the answer duplicated in the transcript and after a terminal resize. ## What changed Use the current stream's fragment count to consolidate the answer into one Markdown cell, preserving the order of notices after it. Preserve the transcript reader's position and active search match during regrouping. When a visible notice splits output already printed to native scrollback, reflow it to restore the answer and notice order. ## Testing Regression coverage checks transcript rendering and resize reflow with interleaved and trailing notices, search match retention, and output queued behind a running tool. GitOrigin-RevId: 8899a1d1d9ea0264548442001a80e1cb8948022a
This commit is contained in:
@@ -135,9 +135,19 @@ impl TranscriptView {
|
||||
snapshot.cells = joined.into();
|
||||
return;
|
||||
}
|
||||
if searching
|
||||
|| matches!(self.position, Position::Reading(anchor)
|
||||
if cells[range].iter().any(|cell| EntryKey::cell(cell) == anchor.key))
|
||||
self.retain_before_regroup(cells, range);
|
||||
}
|
||||
|
||||
/// Preserve the original order before a regroup moves cells across a search cursor.
|
||||
pub(crate) fn retain_before_regroup(
|
||||
&mut self,
|
||||
cells: &[Arc<dyn HistoryCell>],
|
||||
range: Range<usize>,
|
||||
) {
|
||||
if self.snapshot().is_none()
|
||||
&& (self.search.has_active_query()
|
||||
|| matches!(self.position, Position::Reading(anchor)
|
||||
if cells[range].iter().any(|cell| EntryKey::cell(cell) == anchor.key)))
|
||||
{
|
||||
self.held_reading = Some(self.capture_snapshot(cells));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user