[diffs/edit] support paste in place#983
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: 316cca5a9f
ℹ️ 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".
| if (Array.isArray(selectionTexts) && selectionTexts.length > 0) { | ||
| text = selectionTexts; |
There was a problem hiding this comment.
Fall back to plain text when counts differ
Only take the custom payload when it can be applied one-for-one to the current selections. Here any non-empty array replaces the plain clipboard text, but #replaceSelectionText falls back by joining mismatched arrays with \n; copying two collapsed carets on the same line (plain text is bravo\n) and pasting into one selection therefore inserts the duplicated custom pieces instead of the portable text. The custom clipboard-provider branch has the same issue.
Useful? React with 👍 / 👎.
| const multiSelectionText = await clipboard.readText( | ||
| MULTI_SELECTION_CLIPBOARD_TYPE | ||
| ); |
There was a problem hiding this comment.
Preserve existing single-format clipboard providers
Existing users can still pass the old readText: () => string provider because extra arguments are ignored in JS and this was the previous interface. For those providers this call returns the plain clipboard text, JSON parsing fails, and the fallback calls readText() again, so every paste shortcut reads/prompts/side-effects twice; gate typed reads behind provider support or otherwise preserve the single plain read path.
Useful? React with 👍 / 👎.
|
@codex review again |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44750ef1fe
ℹ️ 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".
| const selectionTexts = JSON.parse(multiSelectionText); | ||
| if (Array.isArray(selectionTexts) && selectionTexts.length > 0) { | ||
| text = selectionTexts; |
There was a problem hiding this comment.
Preserve plain text when counts differ
When pasting into multiple selections, this accepts any non-empty metadata array without checking that it matches the current selection count. If a user copies two whole lines and pastes with three cursors, #replaceSelectionText falls back to text.join(textDocument.eol) instead of the plain clipboard entry, so entries that already include trailing line breaks are pasted with extra blank lines at every cursor. Keep using the plain clipboard text unless the metadata length matches the target selections.
Useful? React with 👍 / 👎.
EOLdeleteHardLineForwardcommand for safair/firefoxtokenzier.ts→tokenizer.ts