Skip to content

Move Session View scrollbar to the right - #530

Closed
vanzue wants to merge 2 commits into
mainfrom
dev/vanzue/session-view-scrollbar
Closed

Move Session View scrollbar to the right#530
vanzue wants to merge 2 commits into
mainfrom
dev/vanzue/session-view-scrollbar

Conversation

@vanzue

@vanzue vanzue commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

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

  • Replaces the left-side selection bar with a proportional Ratatui scrollbar on the right edge.
  • Reserves a stable scrollbar gutter so session timestamps do not shift when overflow begins.
  • Hides the scrollbar when all sessions fit in the viewport.
  • Uses a compact, trackless thumb to match the native Terminal scrollbar appearance.
  • Adds coverage for right alignment, styling, and top-to-bottom position tracking.

Validation Steps Performed

  • cargo test --manifest-path tools/wta/Cargo.toml (1214 passed)
  • cargo build --manifest-path tools/wta/Cargo.toml
  • Hot-refreshed the Debug package and launched Intelligent Terminal.

PR Checklist

image

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 30, 2026 09:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::Scrollbar using 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(" "));

Comment thread tools/wta/src/ui/agents_view.rs Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 30, 2026 09:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_state passes max_offset + 1 to ScrollbarState::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)

@vanzue vanzue closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align Session View scrollbar with the native Terminal scrollbar

2 participants