Skip to content

bug: OSC52 clipboard conflicts with Zellij auto-select-copy #14385

Closed

Description

@bnema

Description

When running opencode inside Zellij with copy_on_select true, opencode's OSC52 writes interfere with Zellij's clipboard.

Zellij intercepts OSC52 sequences from child processes and routes them through its own clipboard pipeline instead of forwarding them to the outer terminal emulator. This means opencode's copy shortcut (Ctrl+X Y) never reaches the terminal's clipboard. Worse, it can overwrite whatever Zellij had just auto-copied from a text selection.

Steps to reproduce

  1. Enable auto-select-copy in ~/.config/zellij/config.kdl: copy_on_select true
  2. Run opencode inside Zellij
  3. Select some text in the pane — Zellij copies it to the clipboard
  4. Trigger opencode's copy shortcut (Ctrl+X Y)
  5. Zellij intercepts the OSC52 sequence and overwrites the clipboard with opencode's content

Root Cause

writeOsc52() in packages/opencode/src/cli/cmd/tui/util/clipboard.ts writes to process.stdout. Zellij intercepts that sequence at the PTY layer and processes it internally — it does not forward it to the outer terminal emulator.

Writing to /dev/tty instead would bypass Zellij's PTY entirely, so the sequence goes straight to the outer terminal. This is the same approach used by lazygit and neovim, and it's exactly what PR #12129 proposes.

Environment

  • OpenCode version: latest (dev)
  • Terminal multiplexer: Zellij
  • OS: Linux

Activity

  1. github-actions commented on Feb 20, 2026

    @github-actions
    Contributor

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

    Also note that PR #12129 (referenced in your issue) is already linked to #12082. You may want to follow that issue and PR for updates.

  2. bnema commented on Feb 20, 2026

    @bnema
    ContributorAuthor

    Closing as duplicate of #12082

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions