[PR #4996] add OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT #11199

Closed
opened 2026-02-16 18:16:00 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4996

State: closed
Merged: Yes


Perfect! I've successfully implemented the feature. Here's a summary of the changes:

Changes Made

1. Added flag to flag.ts (line 20):

  • Added OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT flag that reads from the OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT environment variable
  • When set to "true" or "1", it will disable the copy-on-select behavior

2. Updated app.tsx (lines 464-467):

  • Imported the Flag namespace
  • Modified the onMouseUp handler to check if Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT is enabled
  • If the flag is enabled, it clears the selection without copying to the clipboard and returns early
  • Otherwise, it proceeds with the normal copy-on-select behavior

How to Use

Users can now disable copy-on-select by setting the environment variable:

export OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=true
opencode

Or with value "1":

OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=1 opencode

This will allow users to highlight text without automatically polluting their clipboard, addressing the issue raised in #2845.

Closes #4751

New%20session%20-%202025-12-02T20%3A09%3A17.632Z
opencode session  |  github run

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4996 **State:** closed **Merged:** Yes --- Perfect! I've successfully implemented the feature. Here's a summary of the changes: ## Changes Made **1. Added flag to `flag.ts` (line 20):** - Added `OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT` flag that reads from the `OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT` environment variable - When set to `"true"` or `"1"`, it will disable the copy-on-select behavior **2. Updated `app.tsx` (lines 464-467):** - Imported the `Flag` namespace - Modified the `onMouseUp` handler to check if `Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT` is enabled - If the flag is enabled, it clears the selection without copying to the clipboard and returns early - Otherwise, it proceeds with the normal copy-on-select behavior ## How to Use Users can now disable copy-on-select by setting the environment variable: ```bash export OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=true opencode ``` Or with value `"1"`: ```bash OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=1 opencode ``` This will allow users to highlight text without automatically polluting their clipboard, addressing the issue raised in #2845. Closes #4751 <a href="https://opencode.ai/s/ok5CPKeY"><img width="200" alt="New%20session%20-%202025-12-02T20%3A09%3A17.632Z" src="https://social-cards.sst.dev/opencode-share/TmV3IHNlc3Npb24gLSAyMDI1LTEyLTAyVDIwOjA5OjE3LjYzMlo=.png?model=opencode/claude-haiku-4-5&version=1.0.127&id=ok5CPKeY" /></a> [opencode session](https://opencode.ai/s/ok5CPKeY)&nbsp;&nbsp;|&nbsp;&nbsp;[github run](/sst/opencode/actions/runs/19871999779)
yindo added the pull-request label 2026-02-16 18:16:00 -05:00
yindo closed this issue 2026-02-16 18:16:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11199