fix(tui): wire scrollbar-drag entry point; fix clippy warnings (#1163)

- Wire mouse_hits_transcript_scrollbar into the Left-Down handler so the
  scrollbar thumb remains draggable after rebase onto upstream/main.
- Fix clippy::useless_format in memory-overhead test.
This commit is contained in:
Zhiping
2026-05-09 03:51:05 +08:00
committed by Hunter Bown
parent 36a850561b
commit 540a18146f
2 changed files with 17 additions and 7 deletions
+9 -7
View File
@@ -924,9 +924,8 @@ mod tests {
for i in 0..30 {
cells.push(user_cell(&format!("complex query {i} about system design")));
cells.push(HistoryCell::Thinking {
content: format!(
"line A\nline B\nline C\nline D\nline E\nline F\nline G\nline H\nline I\nline J"
),
content: "line A\nline B\nline C\nline D\nline E\nline F\nline G\nline H\nline I\nline J"
.to_string(),
streaming: false,
duration_secs: Some(3.5),
});
@@ -934,9 +933,9 @@ mod tests {
&format!("response {i} with multi-line\ntext content spanning\nseveral lines"),
false,
));
cells.push(exec_tool_cell(&format!(
"cargo test --package my_crate -- --nocapture 2>&1 | head -40"
)));
cells.push(exec_tool_cell(
"cargo test --package my_crate -- --nocapture 2>&1 | head -40",
));
// Insert a second tool so adjacent tool cells merge into a railed group.
cells.push(exec_tool_cell(&format!("git diff --stat HEAD~{i}")));
}
@@ -969,7 +968,10 @@ mod tests {
eprintln!(" lines × 8 bytes: {} KB", total_lines * 8 / 1024);
// Sanity: per-line overhead must be reasonable.
assert!(memory_kb < 1024.0, "rail_prefix_widths memory unexpectedly large: {memory_kb:.1} KB");
assert!(
memory_kb < 1024.0,
"rail_prefix_widths memory unexpectedly large: {memory_kb:.1} KB"
);
eprintln!(" ✓ well under 1 MB even for very long sessions");
}
}
+8
View File
@@ -7605,6 +7605,14 @@ fn handle_mouse_event(app: &mut App, mouse: MouseEvent) -> Vec<ViewEvent> {
app.viewport.transcript_scrollbar_dragging = false;
app.viewport.selection_autoscroll = None;
// Click on the transcript scrollbar gutter starts a scrollbar
// drag so the visible thumb remains interactive for users who
// prefer mouse-based navigation.
if mouse_hits_transcript_scrollbar(app, mouse) {
app.viewport.transcript_scrollbar_dragging = true;
return Vec::new();
}
if mouse_hits_rect(mouse, app.viewport.jump_to_latest_button_area) {
app.scroll_to_bottom();
return Vec::new();