Repository navigation
fix(diff): bring a find match into view on a wrapped row taller than the view - #2156
Conversation
…the view Find centred the active match's whole row. On a wrapped row taller than the view (a long line on a phone with wrapping on) the row's middle could leave a match near its end below the screen. A row taller than the view now centres the match's own text instead. The repository diff browser QA gains a wrapped unchanged line taller than any view with its match at the end; it failed on main (match at y=1254, view ending at 798) and passes at 1440 and 390. Fixes #1602
The demo regression's screenshots were taken while the demo's own timeline ran and while sheets and hover transitions moved. Its clock is now Playwright's, run past the demo's one-shot turn completion, and each shot waits for finite animations (a closed sheet's drop included) and ends running transitions first, as terminal-keyboard-demo-regression.ts does.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Match-based reveal src/components/RepoDiff.tsx, DESIGN.md, changelog.d/diff-find-tall-row.md |
When a row exceeds the view height, settle centers the active match’s text bounds. The design description and changelog document this behavior. |
Reveal and screenshot regression coverage scripts/repo-diff-browser-qa.ts, scripts/diff-find-demo-regression.ts |
The browser QA script checks that a match in an exceptionally tall wrapped row is visible. The demo regression script advances the page clock and waits for finite animations before capturing screenshots. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Possibly related issues
devswha/herdr-web-ui#1602— The PR addresses the issue’s tall wrapped-row reveal and deterministic demo screenshot objectives.
Merge Risk: 
Minimal · up to 5b54e
-
No actionable merge risk was identified for the tall-row reveal or screenshot changes.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Description check
-
Explanation
The description explains the problem, resulting behavior, implementation, regression coverage, and validation results. It uses headings different from the template, but it provides the required Change and Validation information in substance.
Full details: Linked Issues check
-
Explanation
#1602has two active coding follow-ups.RepoDiff.tsxnow centers the active text range when a mounted wrapped row is taller than the view. The existing row, horizontal, unmounted-row, folded-context, and loaded-patch find behavior remains in place.repo-diff-browser-qa.tsverifies the end-of-row match inside the scroll view.diff-find-demo-regression.tsnow controls the clock and finite animations before screenshots. The changed behavior and tests satisfy the current#1602requirements.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within
#1602.DESIGN.mdand the changelog document the tall-row fix. The browser QA fixture tests that fix. The demo regression changes remove timing nondeterminism for the linked find regression. No unrelated product behavior, network protocol, or workspace search change is shown.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 3 files. (2 skipped: 2 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Merging 5b54eb5: omo-native-code-reviewer and Codex both pass this head, and the required checks are green, including the diff browser QA. CodeRabbit did not review this head. The LOW notes go to a follow-up issue. |
What this does for the user
Find in a diff now brings the match itself into view when its row is a wrapped line taller than the screen, such as a long line on a phone with wrapping on. Before, the viewer centred the whole row, so a match near the end of a very long line could stay below the screen (#1602, the follow-up left from #1849).
How
RepoDiff.tsx's reveal (settle()) measures the active row as before; when that row is taller than the view, it centres the match's own text range (the sametextRangethe highlight paints) instead of the row. Every other row is unchanged: a row that fits is still centred whole, an unwrapped row is still scrolled across first, and an unmounted row still goes to the package's estimate first. Precedent: an editor's find (Zed, VS Code) scrolls to the match, not to the line holding it; DESIGN.md's Find in diff entry says so.The diff-find demo regression (
scripts/diff-find-demo-regression.ts), the issue's other open note, now takes its screenshots at fixed moments: its clock is Playwright's, run past the demo's one-shot turn completion (4.5 s after load), and each shot waits for finite animations (a closed sheet's drop,lib/sheets.ts) and ends running transitions first, asterminal-keyboard-demo-regression.tsdoes. Two runs back to back: 58 of 66 shots byte-identical, the other 8 differ by at most 5 grey levels on at most 183 pixels (rasterizer noise); before, 31 differed by state (a sheet mid-slide, a hover mid-fade).Fixes #1602
How it was verified
scripts/repo-diff-browser-qa.tsgains a wrapped unchanged line taller than any view in the long-line fixture, its match at the very end, and asserts the painted match lies inside the scroll view. On main it fails:row {top:-205,bottom:1271}, match {top:1254,bottom:1270}, view {top:269,bottom:798}. With the fix it passes at 1440 and 390, dark and light, with the rest of the script.scripts/diff-find-demo-regression.tspasses (all six widths/themes/languages), twice.bun run check fast: typecheck, build, 7885 unit tests, 0 failures.