TUI: PageUp/PageDown page the scrollback, including over a captured PTY#332
Merged
Conversation
PageUp/PageDown already page-scrolled in the emacs keymap, but only when a PTY session wasn't focused — once a session captured the PTY, raw keys (including PageUp/PageDown) were forwarded to the child, so they no longer scrolled the TUI. The `C-x [` / `C-x ]` chords worked there only because `C-x` is the escape prefix allowed to drive the keymap. - app: in the PTY-capture path, intercept a plain PageUp/PageDown (no chord in flight) and run ScrollPageUp/ScrollPageDown instead of forwarding it to the child — same effect as the C-x [ / C-x ] chords. Tradeoff: a full-screen program in the PTY no longer receives bare PageUp/PageDown. - keymap: add PageUp/PageDown -> ScrollPageUp/ScrollPageDown to the vim profile (the emacs profile already had them) so non-PTY contexts match. Direction is conventional: PageUp scrolls up toward older output (= C-x [), PageDown scrolls down toward newer (= C-x ]). Tests: keymap resolves PageUp/PageDown in both profiles; PageUp/PageDown scroll a captured PTY view's scrollback.
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.
Closes #320.
What
Make
PageUp/PageDownpage-scroll the TUI everywhere, including while a session's PTY is focused.C-x [/ScrollPageUp)C-x ]/ScrollPageDown)Why this wasn't already working
PageUp/PageDownwere already bound to page-scroll in the emacs keymap (keymap.rs:254-255), but only fired when a PTY session wasn't focused. Once a session captures the PTY,app.rsforwards raw keys — includingPageUp/PageDown(\x1b[5~/\x1b[6~) — straight to the child process, so they stopped scrolling the TUI.C-x [/C-x ]kept working there only becauseC-xis the one escape-prefix allowed to drive the keymap.Changes
app.rs— in the PTY-capture path, intercept a plainPageUp/PageDown(no modifiers, no chord mid-flight) and runScrollPageUp/ScrollPageDowninstead of forwarding it to the child.keymap.rs— addPageUp/PageDown→ScrollPageUp/ScrollPageDownto the vim profile too (emacs already had them), so non-PTY contexts match across profiles.Tradeoff
A full-screen program running inside the PTY (
less,vim,man,htop) no longer receives barePageUp/PageDown— scrollback paging wins. TheC-x [/C-x ]chords remain the explicit alternative, and arrow keys / other keys still pass through to the child unchanged.Tests
keymap:PageUp/PageDownresolve toScrollPageUp/ScrollPageDownin both profiles.app:PageUp/PageDownpage a captured PTY view's scrollback (view_scrollback0 → 10 → 0).agentd-clisuite green, incl. the existing PTY-passthrough/scroll tests (no regression).Binary
Code is confined to
crates/cli→ the relevant binary isagent. (Other workspace binaries build but are unchanged from main.)