mdo/editor#732
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 113426c889
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (let lineIndex = 0; lineIndex < lineCount; lineIndex++) { | ||
| const isAtHunkBoundary = currentLine % hunkLineCount === 0; | ||
|
|
||
| const lineHeight = this.getLineHeight(lineIndex, false); | ||
| if (isAtHunkBoundary) { | ||
| hunkOffsets.push(absoluteLineTop - (fileTop + headerRegion)); |
There was a problem hiding this comment.
Iterate from checkpoint line when scanning virtualized hunks
When checkpoint is non-zero (common after scrolling deep into large/wrapped files), this loop restarts lineIndex at 0 while currentLine already starts at checkpoint.lineIndex, and it also appends hunk offsets with push instead of indexing by the actual hunk number. That desynchronizes measured line heights and hunkOffsets, so bufferBefore/bufferAfter are computed from the wrong hunks and the virtualized window can jump or anchor to incorrect positions.
Useful? React with 👍 / 👎.
| const { disableFileHeader = false, collapsed = false } = this.options; | ||
| const lines = this.getOrCreateLineCache(this.file); | ||
| const lastLineIndex = getLastVisibleLineIndex(lines); | ||
| const lastLineIndex = this.getOrCreateLineOffSets(this.file).at(-1) ?? -1; |
There was a problem hiding this comment.
Clamp line indices using line count, not line-start offset
getOrCreateLineOffSets(...).at(-1) returns the character offset of the last line start, not the last valid line index, so this clamp can allow synthetic line indexes far beyond the document length (especially for long first lines or trailing-newline files). That can produce invalid line anchors/positions in getLinePosition and getNumericScrollAnchor, breaking scroll restoration and target-line positioning for small files.
Useful? React with 👍 / 👎.
- Add web app manifest and support files - Add additional styles to support web app mode - Improve search design - Add custom header for an app-like style - Replace custom icons with @pierre/icons - Add splash screen while it loads
Based on #601, but can't select a fork as my base branch.