Skip to content

terminal: fix unreliable middle-click paste on Linux#307884

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/terminal-middle-click-paste-linux
Open

terminal: fix unreliable middle-click paste on Linux#307884
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/terminal-middle-click-paste-linux

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Summary

  • On Linux the middle-click paste in the integrated terminal was unreliable when the click occurred over a word
  • xterm.js intercepts the mouse event to select the word before the browser can perform the primary-selection paste
  • This change explicitly pastes the primary selection clipboard when middleClickBehavior is default on Linux

Fixes #272927

Test plan

  • Open a terminal on Linux
  • Select text somewhere (in terminal or another X app)
  • Middle-click on a word in the terminal, verify the selection is pasted
  • Middle-click on whitespace in the terminal, verify the selection is pasted
  • Verify middleClickBehavior: paste continues to work (pastes regular clipboard)
  • Verify macOS/Windows behavior is unchanged

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

On Linux the middle-click paste in the terminal was unreliable when the
click occurred over a word because xterm.js intercepts the mouse event
to select the word before the browser can perform the primary-selection
paste. Instead of relying on Chromium's primary-selection paste, this
change explicitly pastes the primary selection clipboard when
middleClickBehavior is 'default' on Linux, matching the behavior users
expect and making the paste reliable regardless of cursor position.

Fixes microsoft#272927

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Unreliable middle-mouse-button paste in integrated terminal on Linux

2 participants