feat: add --page-overlap to keep N lines across a page scroll - #313
Merged
Conversation
pgdown and pgup advance the diff by a full screen, so the last line read and the first line of the next screen share no context. --page-overlap N subtracts N from the page motion, carrying the bottom N rows of the screen to the top of the next one. Default 0 keeps current behavior. the overlap is approximate rather than exact: the walk stops on cursor positions and one position can span several rendered rows, so a wrapped line or an annotation block at the page edge carries over more than asked. Half-page motions do not subtract it, since ctrl+d and ctrl+u already retain half a screen. scoped to the diff pane. The tree, TOC and overlay pagers move by entry index rather than visual rows, where a row count has no meaning. Related to #311
the pageRows godoc named only the case that carries over more than requested. The opposite is reachable: worthRollingBack accepts an oversized first step whatever its height, so a block taller than the remaining budget is taken whole and carries over less than N, or nothing. adds a README feature bullet so the approximation is visible to users setting the flag, not just to readers of the walk. The flag description rows stay minimal per the project's flag-description rule.
There was a problem hiding this comment.
Pull request overview
Adds a configurable “page overlap” for full-page diff paging (PgUp/PgDn) so the next screen retains N rows of context from the previous screen, wired through CLI/env/config plus docs and tests.
Changes:
- Introduce
--page-overlap N/REVDIFF_PAGE_OVERLAP/page-overlapconfig plumbing and documentation. - Update diff paging to advance by
max(1, viewportHeight - overlap)for PgUp/PgDn (half-page motions unchanged). - Add tests covering config parsing, model config propagation, and paging behavior.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| site/docs.html | Documents the new --page-overlap option in the website options table. |
| README.md | Adds feature blurb and CLI options table entry for --page-overlap. |
| plugins/pi/skills/revdiff/SKILL.md | Adds examples demonstrating --page-overlap usage in the Pi skill docs. |
| plugins/codex/skills/revdiff/references/config.md | Documents --page-overlap in Codex skill config reference table. |
| .claude-plugin/skills/revdiff/references/config.md | Documents --page-overlap in Claude plugin config reference table. |
| app/config.go | Adds PageOverlap option flag/env/config definition. |
| app/config_test.go | Adds parsing precedence tests (default/flag/env/config/override) for PageOverlap. |
| app/main.go | Wires PageOverlap from parsed options into ui.ModelConfig. |
| app/ui/model.go | Adds pageOverlap mode state and ModelConfig.PageOverlap, clamping negative values. |
| app/ui/model_test.go | Tests NewModel propagation and negative clamping for PageOverlap. |
| app/ui/diffnav.go | Switches PgUp/PgDn to use pageRows() derived from viewport height minus overlap. |
| app/ui/diffnav_test.go | Adds behavioral tests for overlap on PgDn/PgUp and confirms half-page motions ignore overlap. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+134
to
136
| func (m Model) pageRows() int { | ||
| return max(1, m.layout.viewport.Height-m.modes.pageOverlap) | ||
| } |
Comment on lines
214
to
218
| NoTree: opts.NoTree, | ||
| Wrap: opts.Wrap, | ||
| WrapIndent: opts.WrapIndent, | ||
| PageOverlap: opts.PageOverlap, | ||
| Collapsed: opts.Collapsed, |
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.
pgdownandpgupadvance the diff by a full screen, so the last line you read and the first line of the next screen share no context.--page-overlap Nsubtracts N from the page motion, carrying the bottom N rows to the top of the next screen.default is
0, so paging is unchanged for anyone who does not set it. Also available asREVDIFF_PAGE_OVERLAPandpage-overlapin the config file.the whole behavior is a new
pageRows()returningmax(1, Height - overlap)where the two full-page motions previously passedviewport.Heightdirectly. Everything else is config plumbing and docs.three scope decisions worth stating:
ctrl+d/ctrl+ualready retain half a screen, so subtracting an overlap on top would shrink an already-overlapping motion. Pinned by a test.NewModelrather than erroring, following--wrap-indent, which is the same shape of flag and clamps in the same place.the carryover is approximate, not exact, and deviates both ways. Paging stops on cursor positions, and one position can span several rendered rows: a wrapped line or an annotation block at the page edge carries over more than N when the walk rolls back off it, and less than N when the walk takes it whole. In a plain unwrapped diff it is exactly N. This is stated in the
pageRowsgodoc and in the README feature list; the flag description rows stay minimal per the project's flag-description rule.Related to #311