mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:23:33 +00:00
fix(tui): clear chat content area to prevent stuck characters when scrolling
- Clear content_area with spaces before rendering cells each frame - Preserves theme background color while clearing - Minimal performance impact (only clears chat viewport, not full terminal) - Fixes artifacts that remained when scrolling to shorter lines
This commit is contained in:
@@ -5567,6 +5567,18 @@ impl WidgetRef for &ChatWidget<'_> {
|
||||
// Record current viewport height for the next frame
|
||||
self.last_history_viewport_height.set(content_area.height);
|
||||
|
||||
// Clear the content area to prevent stale characters from previous frames
|
||||
// This fixes the "stuck characters" issue when scrolling through chat history
|
||||
// We fill with spaces while preserving the theme background color
|
||||
let clear_style = Style::default()
|
||||
.bg(crate::colors::background())
|
||||
.fg(crate::colors::text());
|
||||
for y in content_area.y..(content_area.y + content_area.height) {
|
||||
for x in content_area.x..(content_area.x + content_area.width) {
|
||||
buf[(x, y)].set_char(' ').set_style(clear_style);
|
||||
}
|
||||
}
|
||||
|
||||
// Render the scrollable content with spacing using prefix sums
|
||||
let mut screen_y = start_y; // Position on screen
|
||||
let spacing = 1u16; // Spacing between cells
|
||||
|
||||
Reference in New Issue
Block a user