Skip to content

Commit 0f6214b

Browse files
d4ncerclaude
andcommitted
fix(ui): standardise Agent Stream scroll to match Events panel
- Change agent_scroll_down to no-op when auto-scrolling (None), matching events_scroll_down and tools_scroll_down behavior - Compute proper max_offset for agent mouse scroll using inner height from rect instead of raw agent_line_count - Remove leftover .min(80) cap on tools scroll range from pre-.rev() removal era Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 978cff7 commit 0f6214b

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

src/ui/app.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,12 @@ fn process_mouse(
478478

479479
if let Some(ref r) = areas.agent {
480480
if in_rect(r) {
481+
let inner_h = r.height.saturating_sub(2) as usize;
482+
let max_offset = state.agent_line_count.saturating_sub(inner_h);
481483
if scroll_lines < 0 {
482484
state.agent_scroll_up((-scroll_lines) as usize);
483485
} else {
484-
state.agent_scroll_down(scroll_lines as usize, state.agent_line_count);
486+
state.agent_scroll_down(scroll_lines as usize, max_offset);
485487
}
486488
return;
487489
}
@@ -504,8 +506,7 @@ fn process_mouse(
504506
if let Some(ref r) = areas.tools {
505507
if in_rect(r) {
506508
let inner_h = r.height.saturating_sub(2) as usize;
507-
let total = state.tools.len().min(80);
508-
let max_offset = total.saturating_sub(inner_h);
509+
let max_offset = state.tools.len().saturating_sub(inner_h);
509510
if scroll_lines < 0 {
510511
state.tools_scroll_up((-scroll_lines) as usize);
511512
} else {

src/ui/state.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,17 @@ impl AppState {
235235
}
236236

237237
/// Scroll the Agent Stream panel down by `n` lines, capped at the bottom.
238-
/// Passing the total line count allows clamping.
238+
/// Reaching the bottom resumes auto-scroll.
239239
pub fn agent_scroll_down(&mut self, n: usize, max_offset: usize) {
240-
let current = self.agent_scroll.unwrap_or(max_offset);
241-
let new = (current + n).min(max_offset);
242-
// If we've scrolled back to the bottom, resume auto-scroll.
243-
if new >= max_offset {
244-
self.agent_scroll = None;
245-
} else {
246-
self.agent_scroll = Some(new);
240+
if let Some(offset) = self.agent_scroll {
241+
let new = (offset + n).min(max_offset);
242+
if new >= max_offset {
243+
self.agent_scroll = None;
244+
} else {
245+
self.agent_scroll = Some(new);
246+
}
247247
}
248+
// If None (auto-scroll), down is a no-op — already at bottom.
248249
}
249250

250251
/// Reset Agent Stream to auto-scroll (follow the tail).

0 commit comments

Comments
 (0)