Move Session View scrollbar to the right - #530
Closed
vanzue wants to merge 2 commits into
Closed
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the WTA TUI “Agent sessions” (F2) Session View to place a native-style scrollbar on the right edge, reserving a stable 1-column gutter and adding tests to validate alignment/styling/position behavior.
Changes:
- Replaced the left-side selection bar with a right-aligned
ratatui::Scrollbarusing a compact thumb and no track symbols. - Reserved a consistent right-side gutter (1 column) so content (notably timestamps) doesn’t shift when overflow begins.
- Added a unit test to validate right alignment, thumb styling, and position tracking.
Comments suppressed due to low confidence (2)
tools/wta/src/ui/agents_view.rs:292
- ScrollbarState position should be clamped to the valid scroll range (0..=content_length-viewport_length). With the current call sites it can exceed the max offset (e.g., when using a selected index), which can yield incorrect rendering and may break if ratatui changes to assert on bounds.
let viewport_length = list_area.height as usize;
if area.width == 0 || viewport_length == 0 || content_length <= viewport_length {
return;
}
tools/wta/src/ui/agents_view.rs:833
- This test sets ScrollbarState::position(7) with content_length=8 and viewport_content_length=4. For ratatui scrollbars, position represents the scroll offset, whose maximum here is 8-4=4. Using an out-of-range position makes the test rely on implicit clamping behavior and doesn't validate the intended contract.
let mut bottom_state = ScrollbarState::new(8)
.position(7)
.viewport_content_length(4);
StatefulWidget::render(session_scrollbar(), area, &mut at_bottom, &mut bottom_state);
assert_eq!(at_bottom.cell((4, 3)).map(|cell| cell.symbol()), Some("▐"));
assert_eq!(at_bottom.cell((4, 0)).map(|cell| cell.symbol()), Some(" "));
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
tools/wta/src/ui/agents_view.rs:313
session_scrollbar_statepassesmax_offset + 1toScrollbarState::new(...), but Ratatui expects the total scrollable content length there (e.g.rows.len()). Using the number of offsets makes the thumb size/position math wrong (for small lists it can become dramatically oversized), so the scrollbar no longer represents the list proportionally.
// With an explicit viewport, Ratatui derives the total extent from the
// number of valid offsets plus the viewport length.
ScrollbarState::new(max_offset.saturating_add(1))
.position(scroll_offset.min(max_offset))
.viewport_content_length(viewport_length)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Moves the Session View scrollbar from the left side to the right side and aligns its presentation with the native Terminal scrollbar.
References and Relevant Issues
Closes #528
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
cargo test --manifest-path tools/wta/Cargo.toml(1214 passed)cargo build --manifest-path tools/wta/Cargo.tomlPR Checklist