[diffs/edit] Fix surrogate-pair edit boundaries - #989
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: 00b93ca7cb
ℹ️ 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".
| } | ||
| return this.applyResolvedEdits( | ||
| edits.map((edit) => this.#resolveEdit(edit)), | ||
| this.resolveEdits(edits), |
There was a problem hiding this comment.
Normalize resolved edits before applying them
Since the surrogate-pair widening is only done when TextEdit ranges go through resolveEdits, callers that already have UTF-16 offsets still bypass the fix via the exported applyResolvedEdits API; several editor selection helpers also use that path. For example, new TextDocument(..., '📚plans').applyResolvedEdits([{ start: 1, end: 1, text: 'a' }]) still inserts between the high and low surrogate and leaves lone surrogates in the buffer, so typing/paste-like flows that produce resolved offsets can still corrupt the document even though the known bug was removed.
Useful? React with 👍 / 👎.
* Refactor edit resolution logic to improve surrogate pair handling * fix codex
Fixed surrogate-pair edit boundaries.