Skip to content

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

Open
HackAttack wants to merge 1 commit into
herdrdev:masterfrom
HackAttack:fix-pageup-scroll-decckm
Open

fix: page keys scroll pane scrollback at zsh and REPL prompts#2191
HackAttack wants to merge 1 commit into
herdrdev:masterfrom
HackAttack:fix-pageup-scroll-decckm

Conversation

@HackAttack

Copy link
Copy Markdown

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: a80b239e-74dd-49ca-bd98-fcd7d9ab1e3e

📥 Commits

Reviewing files that changed from the base of the PR and between 9a4ce5e and 575f917.

📒 Files selected for processing (3)
  • src/app/input/terminal.rs
  • src/pane/terminal.rs
  • src/server/headless.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/app/input/terminal.rs, src/server/headless.rs
Tests verify that PageUp advances host scrollback and sends no input to the shell or PTY.

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

Possibly related PRs

  • herdrdev/herdr#2142: Both PRs modify PageUp handling in terminal input code, but this PR focuses on host scrollback with DECCKM and bracketed paste.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the fix for PageUp and PageDown scrolling at zsh and REPL prompts.
Description check ✅ Passed The description explains the DECCKM issue, the bracketed-paste solution, and the resulting scrollback behavior.
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 shell-like primary-screen sessions using both application-cursor mode and bracketed paste scroll Herdr’s pane history instead of sending the keys to the prompt.

  • Treats bracketed paste as a shell-prompt discriminator when DECCKM is enabled.
  • Adds application-level and headless-server coverage for the revised routing behavior.
  • Preserves forwarding for alternate-screen, mouse-reporting, and pager-like DECCKM states without bracketed paste.

Confidence Score: 5/5

The PR appears safe to merge with the intended prompt and pager routing behavior covered in both local and headless paths.

The changed predicate consistently routes shell-like DECCKM plus bracketed-paste states to host scrollback while retaining existing alternate-screen, mouse-reporting, and pager-like forwarding guards.

Important Files Changed

Filename Overview
src/pane/terminal.rs Updates the terminal-mode predicate to classify DECCKM plus bracketed paste as shell-like and adds focused unit coverage.
src/app/input/terminal.rs Adds an integration test confirming PageUp scrolls pane history rather than reaching a zsh-like prompt.
src/server/headless.rs Adds equivalent coverage for PageUp routing through terminal-attach clients.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    K[Plain PageUp or PageDown] --> A{Alternate screen or mouse reporting?}
    A -- Yes --> F[Forward key to terminal application]
    A -- No --> D{DECCKM enabled?}
    D -- No --> S[Scroll Herdr pane scrollback]
    D -- Yes --> B{Bracketed paste enabled?}
    B -- Yes --> S
    B -- No --> F
Loading

Reviews (1): Last reviewed commit: "fix: page keys scroll pane scrollback at..." | Re-trigger Greptile

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.

3 participants