Skip to content

fix: page keys scroll pane scrollback at zsh and REPL prompts - #2191

Merged
ogulcancelik merged 3 commits into
herdrdev:masterfrom
HackAttack:fix-pageup-scroll-decckm
Aug 3, 2026
Merged

fix: page keys scroll pane scrollback at zsh and REPL prompts#2191
ogulcancelik merged 3 commits into
herdrdev:masterfrom
HackAttack:fix-pageup-scroll-decckm

Conversation

@HackAttack

Copy link
Copy Markdown
Contributor

PageUp/PageDown were forwarded to the pane whenever DECCKM (application cursor) was on, assuming only primary-screen pagers enable it, but zsh's line editor also enables DECCKM, as do REPLs such as python3. The result was PageUp scrolling shell history instead of Herdr scrollback.

Bracketed paste discriminates the two: it means the app accepts typed or pasted text at a prompt, so line editors enable it and pagers do not.

Related: #953

PageUp/PageDown were forwarded to the pane whenever DECCKM (application
cursor) was on, assuming only primary-screen pagers enable it, but zsh's
line editor also enables DECCKM, as do REPLs such as python3. The result
was PageUp scrolling shell history instead of Herdr scrollback.

Bracketed paste discriminates the two: it means the app accepts typed or
pasted text at a prompt, so line editors enable it and pagers do not.
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dc71f042-c209-4de5-8ce0-9bfb4e662355

📥 Commits

Reviewing files that changed from the base of the PR and between 48d8e74 and b13a1a4.

📒 Files selected for processing (1)
  • src/pane/terminal.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pane/terminal.rs

📝 Walkthrough

Walkthrough

The change allows PageUp to scroll host pane history when DECCKM and bracketed paste are active. Regression tests verify local key consumption, scrollback movement, and no shell or PTY input.

Changes

PageUp host scrollback

Layer / File(s) Summary
Update host scrollback condition
src/pane/terminal.rs
plain_page_keys_use_host_scrollback now permits host scrollback with application cursor mode when bracketed paste is enabled. Alternate-screen and mouse-reporting exclusions remain active.
Verify PageUp handling
src/pane/terminal.rs, src/app/input/terminal.rs, src/server/headless.rs
Tests verify PageUp host scrolling, local key consumption, and no input forwarding to the shell or PTY.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TerminalInput
  participant InputState
  participant HostScrollback
  participant ShellOrPTY
  TerminalInput->>InputState: Process PageUp with DECCKM and bracketed paste enabled
  InputState->>HostScrollback: Consume PageUp and advance pane scrollback
  InputState--xShellOrPTY: Do not forward PageUp bytes
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the fix for PageUp and PageDown behavior in zsh and REPL prompts.
Description check ✅ Passed The description accurately explains the DECCKM and bracketed-paste behavior that causes the scrollback issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 2, 2026
@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown

Greptile Summary

This PR refines plain PageUp/PageDown routing so zsh and REPL prompts using both application-cursor and bracketed-paste modes use Herdr scrollback while primary-screen pagers continue receiving page keys.

  • Extends the shared terminal input-state predicate with bracketed-paste mode.
  • Adds application and headless-server coverage for the shell-like mode combination.
  • Preserves forwarding for alternate-screen, mouse-reporting, and pager-like application-cursor states.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/pane/terminal.rs Refines the shared page-key routing predicate to recognize shell-like DECCKM sessions through bracketed-paste mode and adds direct predicate coverage.
src/app/input/terminal.rs Adds an application-level test confirming PageUp scrolls the host pane rather than reaching a zsh-like prompt.
src/server/headless.rs Adds equivalent headless terminal-attach coverage for the revised page-key routing behavior.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    K[Plain PageUp or PageDown] --> A{Alternate screen or mouse reporting?}
    A -- Yes --> P[Forward key to pane]
    A -- No --> C{Application cursor enabled?}
    C -- No --> H[Use Herdr scrollback]
    C -- Yes --> B{Bracketed paste enabled?}
    B -- Yes --> H
    B -- No --> P
Loading

Reviews (3): Last reviewed commit: "test: update page key state fixture" | Re-trigger Greptile

@ogulcancelik
ogulcancelik merged commit eacea2d into herdrdev:master Aug 3, 2026
8 checks passed
@ogulcancelik

Copy link
Copy Markdown
Collaborator

ty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Trigger automated AI reviews for pull requests admitted by the PR gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants