chat: double-buffered sync with content-length diffing

Store content lengths of rendered entries. On each tick:
- Generation changed → full pane reset
- Entries removed → pop from tail
- Last entry content length changed → pop and re-render (streaming)
- New entries → route and push

PaneState gains pop_line() for removing the last rendered entry.
This handles streaming (last entry growing), compaction (generation
bump), and normal appends.

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2026-04-05 19:35:19 -04:00
parent 563771e979
commit ca9f2b2b9a
2 changed files with 57 additions and 29 deletions

View file

@ -190,6 +190,11 @@ impl PaneState {
self.evict();
}
pub(crate) fn pop_line(&mut self) {
self.lines.pop();
self.markers.pop();
}
fn scroll_up(&mut self, n: u16) {
self.scroll = self.scroll.saturating_sub(n);
self.pinned = true;