Preview streaming prose before a newline arrives in the TUI (#45135)

## Why

Unterminated prose stayed hidden until a newline arrived or the stream completed, leaving long single-line responses invisible while they streamed.

## What changed

- Show live prose previews for agent messages and proposed plans, requesting redraws when the preview changes.
- Keep previews out of the scrollback queue and render the full source on newline or completion without duplicating text.
- Bound previews to the most recent 8 KiB at a Unicode character boundary, with an ellipsis for omitted text, and reflow them when the width changes.
- Preserve holdback for incomplete table and code structures, retaining the last safe prose preview when a pipe arrives.

## Testing

Add controller tests and TUI snapshots covering visibility before completion, resize reflow, finalization without duplication, long Unicode previews, table and code holdback, and inline visualization context.

GitOrigin-RevId: 26c83c218b986625820b20779a46d1b800a7e0ff
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-12 23:54:20 +00:00
1 parent b979d4f1f0
commit b966240bea
13 files changed
+386 -53

No files matched your search

+5
View File
@@ -100,6 +100,11 @@ impl MarkdownStreamCollector {
&self.buffer[..self.committed_source_len]
}
/// Return the incomplete line without advancing the scrollback commit boundary.
pub fn pending_source(&self) -> &str {
&self.buffer[self.committed_source_len..]
}
/// Finalize the stream and transfer its complete raw source.
///
/// Ensures the returned source chunk is newline-terminated when non-empty so callers can