Skip to content

fix(diffs): Suppress repeated paste shortcuts#938

Merged
necolas merged 1 commit into
beta-1.3from
nicolas/editor-paste-lag
Jul 3, 2026
Merged

fix(diffs): Suppress repeated paste shortcuts#938
necolas merged 1 commit into
beta-1.3from
nicolas/editor-paste-lag

Conversation

@necolas

@necolas necolas commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

A user can trigger the lag like this:

  1. Focus an editable diff.
  2. Hold Cmd+V or Ctrl+V with text on the clipboard.
  3. The editor accepts each repeated paste keydown.
  4. Each paste can add lines and make the page fall behind.

The root cause is that a held paste key produces repeat keydown events. Each accepted repeat can lead to another paste and another expensive diff update. For multi-line text, that update can recompute diff state from the full edited document.

Suppress repeated paste keydowns and let the first keydown keep the existing behavior. This keeps normal paste, including custom clipboard providers, while blocking the runaway repeat path.

@vercel

vercel Bot commented Jul 2, 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 2, 2026 8:11pm
pierre-docs-diffshub Ready Ready Preview Jul 2, 2026 8:11pm
pierre-docs-trees Ready Ready Preview Jul 2, 2026 8:11pm
pierrejs-diff-demo Ready Ready Preview Jul 2, 2026 8:11pm

Request Review

@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: a0f0f99be5

ℹ️ 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
A user can trigger the lag like this:
1. Focus an editable diff.
2. Hold Cmd+V or Ctrl+V with text on the clipboard.
3. The editor accepts each repeated paste keydown.
4. Each paste can add lines and make the page fall behind.

The root cause is that a held paste key produces repeat keydown events.
Each accepted repeat can lead to another paste and another expensive diff
update. For multi-line text, that update can recompute diff state from
the full edited document.

Suppress repeated paste keydowns and let the first keydown keep the
existing behavior. This keeps normal paste, including custom clipboard
providers, while blocking the runaway repeat path.

@ije ije left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice

@necolas necolas merged commit bb3a3d7 into beta-1.3 Jul 3, 2026
8 checks passed
@necolas necolas deleted the nicolas/editor-paste-lag branch July 3, 2026 17:45
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.

2 participants