Batch mouse wheel scrolling in the TUI (#62146)

## Why

Rapid wheel input can trigger a synchronous transcript redraw for each tick, even when the current layout can still be used.

## What changed

Accumulate wheel movement in the main transcript and side panes until the next frame when the rendered layout is safe to reuse. Refresh first when the transcript has changed, cached content can change height, or the side pane has buffered reply text. Refresh immediately when toggling side-pane zoom so subsequent mouse events use the new layout.

Start composer scrolling from the caret-adjusted viewport after an edit so wheel ticks can accumulate before the next frame.

## Testing

Cover wheel bursts while the plan menu is open, composer scrolling after edits, refresh requirements for mutable history and buffered side replies, and immediate layout updates when toggling side-pane zoom.

GitOrigin-RevId: 342d4d4c014d8a41b2e690b91622197ee97fc059
This commit is contained in:
Benjamin Carlsson
2026-11-18 00:58:27 +00:00
committed by copyberry
parent 67d8266e06
commit 2f5c413e19
12 changed files with 157 additions and 19 deletions
+17
View File
@@ -983,6 +983,23 @@ impl HistoryCell for MutableHistoryCell {
}
}
#[test]
fn cached_mutable_history_prevents_reusing_painted_geometry() {
let mutable: Arc<dyn HistoryCell> = Arc::new(MutableHistoryCell {
version: Arc::new(AtomicUsize::new(/*v*/ 1)),
renders: Arc::default(),
});
let cells = vec![mutable, cell("static tail")];
let mut view = TranscriptView::default();
render(&mut view, &cells, /*width*/ 24, /*height*/ 16);
assert!(!view.can_scroll_without_refresh(&cells, /*live_key*/ None));
drop(cells);
let cells = vec![cell("static tail")];
render(&mut view, &cells, /*width*/ 24, /*height*/ 16);
assert!(view.can_scroll_without_refresh(&cells, /*live_key*/ None));
}
#[test]
fn mutable_history_formats_once_per_frame_and_refreshes_the_next_frame() {
let version = Arc::new(AtomicUsize::new(/*v*/ 1));