fix(tui): repaint fully while scrolling chat

This commit is contained in:
patriceckhart 2026-04-21 21:29:08 +02:00
parent 43aca0b9b2
commit a739ef9a8b
2 changed files with 17 additions and 0 deletions

View file

@ -530,6 +530,13 @@ func (i *Interactive) scrollBy(delta int) {
i.parkedTurn = 0
i.parkedTotal = 0
}
if i.rend != nil {
// VS Code's terminal is especially prone to leaving stray
// wrapped-character fragments behind during scroll-driven
// viewport changes. Force a full repaint on scroll, but
// avoid a whole-screen clear because that visibly flickers.
i.rend.Invalidate()
}
i.mu.Unlock()
i.invalidate()
}
@ -540,6 +547,9 @@ func (i *Interactive) scrollToBottom() {
i.scrollOffset = 0
i.parkedTurn = 0
i.parkedTotal = 0
if i.rend != nil {
i.rend.Invalidate()
}
i.mu.Unlock()
i.invalidate()
}

View file

@ -62,6 +62,13 @@ func (r *Renderer) Clear() {
_, _ = io.WriteString(r.out, SeqClearScreen)
}
// Invalidate forces a full repaint on the next Draw without clearing the
// whole terminal first. Useful when the cached diff is unreliable but a
// visible full-screen flash would be too distracting.
func (r *Renderer) Invalidate() {
r.prev = nil
}
// Draw updates the terminal so that the visible frame ends with the
// given lines (bottom-aligned). cursorRow/cursorCol are offsets within
// the lines slice indicating where to place the terminal cursor; use