Skip to content

[diffs/edit] support paste in place#983

Merged
ije merged 10 commits into
beta-1.3from
ije/fix-todos
Jul 15, 2026
Merged

[diffs/edit] support paste in place#983
ije merged 10 commits into
beta-1.3from
ije/fix-todos

Conversation

@ije

@ije ije commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator
  • Support copy multiple selections and paste them in place
  • Cache document EOL
  • Fix deleteHardLineForward command for safair/firefox
  • ‎Fix typo tokenzier.ts‎tokenizer.ts

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierre-docs-diffs Ready Ready Preview Jul 15, 2026 10:17am
pierre-docs-diffshub Ready Ready Preview Jul 15, 2026 10:17am
pierre-docs-trees Ready Ready Preview Jul 15, 2026 10:17am
pierrejs-diff-demo Ready Ready Preview Jul 15, 2026 10:17am

Request Review

@ije ije changed the title [diffs/edit] [diffs/edit] support paste in place Jul 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/diffs/src/editor/editor.ts Outdated
Comment on lines +1497 to +1498
if (Array.isArray(selectionTexts) && selectionTexts.length > 0) {
text = selectionTexts;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in c48305a

Comment thread packages/diffs/src/editor/editor.ts Outdated
Comment on lines +1762 to +1764
const multiSelectionText = await clipboard.readText(
MULTI_SELECTION_CLIPBOARD_TYPE
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in af93572

@ije

ije commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review again

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +1497 to +1499
const selectionTexts = JSON.parse(multiSelectionText);
if (Array.isArray(selectionTexts) && selectionTexts.length > 0) {
text = selectionTexts;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in b9f5b40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant