[diffs/editor] Fix diff re-render bug in edit mode#928
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4194855c94
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| (hasOnlyBlankAdditionContents(additionLines) || | ||
| hasTrailingEditorBlankLine(additionLines)) |
There was a problem hiding this comment.
Restrict top-align recompute to blank additions
When an edit leaves the new document shorter than the old side and ending with a newline, additionLines now includes a trailing editor row such as ['kept\n', ''], so this condition routes contentful edits through recomputeTopAlignedAdditionDiff. That recompute parses a whitespace sentinel and only swaps the real additionLines back in, so unchanged lines that should remain context are instead rendered as top-aligned changes, corrupting ordinary edit-mode diffs such as deleting all but one matching line from a longer file. Keep this sentinel path limited to blank/delete-all additions or preserve the trailing caret row without replacing hunk metadata with sentinel hunks.
Useful? React with 👍 / 👎.
|
@necolas now does it work? |
|
No still happens.
New line is always at the bottom. Type something and it jumps up to the top |

reproduct steps: