Skip to content

Clipboard copy broken in terminals without OSC52 support #11996

Closed

Description

@MartinWie

Problem

After #11744 introduced OSC52 clipboard support, clipboard copy stopped working in terminals that don't have OSC52 enabled.

The issue is in packages/opencode/src/cli/cmd/tui/util/clipboard.ts:

const copied = renderer.copyToClipboardOSC52(text)
if (copied) return  // <-- early return skips native clipboard

copyToClipboardOSC52() returns true after writing the escape sequence, but the terminal may not actually support or process OSC52. The early return skips the native fallback (osascript on macOS, xclip on Linux).

Steps to Reproduce

  1. Use a terminal with OSC52 disabled (e.g., iTerm2 without "Applications in terminal may access clipboard")
  2. Try to copy text in OpenCode (e.g., <leader>y)
  3. Clipboard is empty

Expected Behavior

Clipboard copy should work regardless of OSC52 support by always falling back to native methods.

Environment

  • macOS with iTerm2
  • OSC52 disabled in terminal settings

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Feb 3, 2026
  2. github-actions commented on Feb 3, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Both issues relate to clipboard copy failures when OSC52 is not available or not working. The root cause appears to be similar: the early return after copyToClipboardOSC52() succeeds skips native clipboard fallbacks, leaving users without a working clipboard solution.

    Feel free to ignore if your specific case is different, but these issues likely share the same underlying problem and solution.

  3. MartinWie commented on Feb 3, 2026

    @MartinWie
    ContributorAuthor

    Closing because the fix was already merged

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

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions