Skip to content

TUI: PageUp/PageDown page the scrollback, including over a captured PTY#332

Merged
edwin-zvs merged 1 commit into
mainfrom
bind-pageup-pagedown-scroll
Jun 2, 2026
Merged

TUI: PageUp/PageDown page the scrollback, including over a captured PTY#332
edwin-zvs merged 1 commit into
mainfrom
bind-pageup-pagedown-scroll

Conversation

@edwin-zvs

@edwin-zvs edwin-zvs commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Closes #320.

What

Make PageUp / PageDown page-scroll the TUI everywhere, including while a session's PTY is focused.

  • PageUp → scroll up toward older output (same action as C-x [ / ScrollPageUp)
  • PageDown → scroll down toward newer output (same action as C-x ] / ScrollPageDown)

Why this wasn't already working

PageUp/PageDown were 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.rs forwards raw keys — including PageUp/PageDown (\x1b[5~ / \x1b[6~) — straight to the child process, so they stopped scrolling the TUI. C-x [ / C-x ] kept working there only because C-x is the one escape-prefix allowed to drive the keymap.

Changes

  • app.rs — in the PTY-capture path, intercept a plain PageUp/PageDown (no modifiers, no chord mid-flight) and run ScrollPageUp/ScrollPageDown instead of forwarding it to the child.
  • keymap.rs — add PageUp/PageDownScrollPageUp/ScrollPageDown to 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 bare PageUp/PageDown — scrollback paging wins. The C-x [ / C-x ] chords remain the explicit alternative, and arrow keys / other keys still pass through to the child unchanged.

Tests

  • keymap: PageUp/PageDown resolve to ScrollPageUp/ScrollPageDown in both profiles.
  • app: PageUp/PageDown page a captured PTY view's scrollback (view_scrollback 0 → 10 → 0).
  • Full agentd-cli suite green, incl. the existing PTY-passthrough/scroll tests (no regression).

Binary

Code is confined to crates/cli → the relevant binary is agent. (Other workspace binaries build but are unchanged from main.)

No recording attached — it's a keybinding tweak with no new UI surface, and the behavior is covered by tests. Happy to add a vhs clip of PageUp paging scrollback if useful.

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.
@edwin-zvs
edwin-zvs merged commit 91234b6 into main Jun 2, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the bind-pageup-pagedown-scroll branch June 2, 2026 14:29
@edwin-zvs edwin-zvs mentioned this pull request Jun 2, 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.

tui: PageUp/PageDown don't scroll a focused/zoomed terminal session (keys captured by PTY, snap to live)

1 participant