Backspace/Delete in the agent chat overwrites the X11 PRIMARY selection (Linux) — pre-0.47.0 Lexical still bundled

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

On Linux/X11, every Backspace or Delete keystroke inside the Cursor agent chat input silently overwrites the X11 PRIMARY selection (the middle-click paste buffer) with the character that was just deleted. Ctrl+Backspace overwrites it with the deleted word. This makes middle-click paste effectively unusable while chatting with the agent.
This is a known upstream Lexical bug (Cursor is named explicitly in the report). The upstream fix has been merged and released in Lexical v0.47.0. Cursor has not yet bumped its Lexical dependency; the buggy code path is still present as of 3.13.

Steps to Reproduce

  1. Linux/X11 session (X11, or XWayland — reproducible in both).
  2. Seed PRIMARY from any other app, e.g. select some text in a terminal, then confirm:
    xsel -o --primary


3. Click into the Cursor agent chat input, type a few characters, then press Backspace without selecting anything.
4. Check PRIMARY again with xsel -o --primary (or watch -n 0.2 'xclip -o -selection primary | head -c 200').

Expected Behavior

Actual: PRIMARY now contains the character that was just deleted. Every subsequent Backspace overwrites it with the next deleted character. Ctrl+Backspace overwrites it with the deleted word. The user’s previous PRIMARY contents are destroyed.
Expected: PRIMARY should only be updated on explicit user-driven selection (mouse drag, Shift+Arrow). Deletion should not touch it. Native Linux editors (Kate, gedit, Sublime, and Cursor’s own Monaco-based code editor) behave this way.

Operating System

Linux

Version Information

Version: 3.13.25
VS Code Extension API: 1.128.0
Commit: 31e8d61c448c7472e371505838a0fe34083dad50
Date: 2026-07-28T06:17:45.069Z
Layout: IDE
Build Type: Stable
Release Track: Default
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.256
OS: Linux x64 6.18.26-gentoo

Additional Information

Cursor’s chat input is built on Meta’s Lexical editor framework. Lexical’s RangeSelection.deleteCharacter / deleteWord / deleteLine used the native DOM API Selection.modify('extend', …) to extend the selection over the target range before removing text. On Linux, Chromium propagates any non-collapsed DOM selection made during a user gesture to PRIMARY, so the extended one-character/one-word selection is written to PRIMARY on every deletion.
The upstream fix rewrites the deletion path to never create a non-collapsed DOM selection (uses modify('move', …) on a collapsed caret to measure the boundary, then applies the edit via the Lexical model directly).

See - Lexical issue: Bug: deleteCharacter() overwrites X11 PRIMARY selection via Selection.modify() · Issue #8766 · facebook/lexical · GitHub (repro is identical; explicitly mentions Cursor)

This issue was fixed in Lexical v0.47.0 .
Please bump to this or a later version.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey Thomas,
I was able to confirm what you’re describing. Our editor’s own code editor isn’t affected, which lines up with what you saw.

We’ve let the team know and this is an issue we’re tracking. I don’t have a timeline to share yet, but I’ll post here when there’s an update.

In the meantime, the practical workaround is to lean on the regular clipboard (Ctrl+C / Ctrl+V) instead of the middle-click PRIMARY buffer while you’re typing in the chat - PRIMARY will keep getting clobbered by deletions until this is addressed, so it isn’t reliable for now. Not a real fix, just a way to avoid losing your selection mid-conversation.