Scroll split windows independently#274
Merged
Merged
Conversation
edwin-zvs
added a commit
that referenced
this pull request
May 30, 2026
PR #274 made scroll offsets per-window in `window_scrollback`, keyed on the active window id. Render always goes through `render_main_windows` → `render_terminal_for_window` and passes `Some(window_id)` even when the main-window tree is a single Leaf, so it reads `window_scrollback[active_window_id]`. The scroll handlers, however, conditioned on `is_split_layout()` and used `None` whenever the tree wasn't a real split — writing to `view_scrollback` instead of `window_scrollback`. In single-pane mode the scrollbar appeared (the mirror got updated) but the viewport never moved because render read from the empty per-window store. Split layouts worked because both sides keyed on `Some(window_id)`. Drop the `is_split_layout()` gate at every scroll-handler call site — keystroke snap, keyboard scroll, mouse wheel, scrollbar drag, ScrollTop / ScrollBottom — so the scroll path keys on the same `Some(active_window_id)` the render path uses. `set_scrollback_for_window` already mirrors the write into `view_scrollback` when `window_id == active_window_id`, so the zoomed render path (which reads `view_scrollback`) still works. Add `scroll_in_single_pane_updates_what_render_reads` as a regression guard, and update `pty_keystroke_snapping_scrollback_still_redraws` to set up state via the canonical `set_scrollback_for_window` instead of mutating the now-mirror-only `view_scrollback` field directly. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Tests
cargo test -p agentd-cli mouse_scrollback_targets_only_hovered_splitcargo test -p agentd-cli switch_focus_cycles_list_then_first_split_windowcargo test -p agentd-cli mouse_list_click_updates_active_split_selectioncargo check -p agentd-clicargo buildgit diff --checkBinaries
Built in this worktree under
/Users/moon/agentd/.claude/worktrees/tui-independent-split-scroll/target/debug/.Relevant binary for this PR:
agent(crates/cli).