fix(web): keep the wrapped file editor anchored on redo and digit boundaries - #10508
fix(web): keep the wrapped file editor anchored on redo and digit boundaries#10508Mnigos wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — The PR fixes narrowly described redo and digit-boundary jumps with focused virtualization tests, but it changes shared production editor caching, resize reconciliation, DOM row lifecycle, and option handling. Those changes affect existing file and diff viewing behavior beyond a single isolated path and warrant human review. Notes:
You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughVirtualized file layout updates now support partial invalidation, resize reconciliation, and zero-width safeguards. Editor updates synchronize changed documents and stale rows. Renderer updates clean caches, compute languages consistently, and expose additional package entry points. ChangesVirtualized editor behavior
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The editor now retains virtualization measurements across relevant edits and width changes and removes stale line elements so redo can locate the recreated caret. The targeted regressions are covered, with no remaining merge-readiness risk identified. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
5660af3 to
19d507e
Compare
Editing a large wrapped file in the Files surface still jumps in two cases that stayed open on #7907 after #10018: pressing Enter when the line count crosses a digit boundary (999 to 1000), and the first Redo after a run of Undos. Both leave the caret off screen.
Both fixes live in the patched
@pierre/diffseditor.offsetTopof 0, and scrolled the caret to the top of the rendered block. Removed rows are now evicted from the cache.Not changed: resizing the panel with the caret mid file can still jump. The browser's scroll anchoring and the virtualizer's own anchor both move the viewport after a native rewrap, which needs a change to the virtualizer's render order. That part of #7907 stays open.
Verification
vp test run apps/web/src/components/files/fileEditorVirtualization.test.ts: 28 tests pass. The width and digit-boundary tests now encode the estimate policy. The new redo test fails on main withtranslateY(0px)and passes here.scrollTop/L<caret line>comes from the native shadow-DOM selection.end, Undo ×8Before
Recorded on main today for the #7907 retest (comment).
Before recording, MP4
After
After recording, MP4
Screenshots after the boundary Enter and after the first Redo
Related to #7907. Implemented with Claude Code (Claude Fable 5).
Note
Keep wrapped file editor anchored on redo and digit boundaries
VirtualizedFile;Editornow removes deleted gutter rows from the line-element cache and always passes the edit start line to document-change invalidation instead of selecting the file start based on line-number digit widthCSSStyleDeclarationreads/writesdist.components.VirtualizedFileanddist.editor.Editorartifacts remove cached code-width state and change layout invalidation to use edit start line — callers relying on full-width cache invalidation on resize or digit-width-based file-start selection will see different measurement retention behaviorMacroscope summarized 5660af3.
Summary by CodeRabbit