Skip to content

tui: v2.4.1 on WSL2 shows "Copied to clipboard" on select, but Ctrl+V paste does nothing; disabling mouse breaks scrollback #65913

Duplicate

Description

@virafb

Summary

After upgrading to OpenCode v2.4.1 on WSL2 (Windows Terminal), selecting text in the TUI displays the "Copied to clipboard" toast, but pasting with Ctrl+V does not work (this worked in the immediately preceding release used an hour earlier). Disabling mouse capture ("mouse": false) as a workaround makes mouse-wheel scrolling unusable because the wheel cycles through prompt command history instead of scrolling the session transcript.

Environment

  • opencode version: 2.4.1
  • OS: Linux 6.18.58.1-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC x86_64 GNU/Linux (Ubuntu 26.04.1 LTS on WSL2)
  • Terminal: Windows Terminal (WT_SESSION set, TERM=xterm-256color, TERM_PROGRAM unset, COLORTERM unset)
  • Display / clipboard environment: DISPLAY=:0, WAYLAND_DISPLAY=wayland-0, XDG_RUNTIME_DIR=/run/user/1000 (/run/user/1000/wayland-0 symlinks to /mnt/wslg/runtime-dir/wayland-0); wl-copy, xclip, and xsel not installed (clip.exe and powershell.exe present via WSL interop)
  • Shell: /bin/bash
  • Install/channel: latest (installed CLI binary + background service)
  • Active plugins: two local workspace plugins (PATH shims and skill-origin guard; neither touches clipboard or mouse handling)

Reproduction

  1. Run opencode (v2.4.1) in Windows Terminal inside WSL2 Ubuntu 26.04.1 LTS with default cli.json ("mouse": true).
  2. Select text from a session response with the mouse. The TUI displays "Copied to clipboard".
  3. Attempt to paste with Ctrl+V.
  4. Set "mouse": false in ~/.config/opencode/cli.json (or via Open settings) to restore native terminal selection, then scroll with the mouse wheel.

Expected Behavior

  1. Text reported as "Copied to clipboard" is actually written to the Windows clipboard and pastes cleanly with Ctrl+V, as it did prior to upgrading to v2.4.1.
  2. Disabling mouse capture does not hijack mouse-wheel scrolling into prompt command history without a working way to scroll the transcript.

Actual Behavior

  1. With "mouse": true (default in v2.4.1), selecting text shows the "Copied to clipboard" toast, but Ctrl+V does not paste the selected text.
  2. With "mouse": false, mouse-wheel scrolling sends Up/Down arrow navigation in alternate screen mode, cycling through previous prompt commands instead of scrolling the screen.

Additional Context

  • Reproducible consistently (100% since upgrading to v2.4.1).
  • Worked in the prior installed OpenCode release (~1 hour before upgrading to v2.4.1).
  • Holding Shift while dragging with "mouse": true is a partial workaround to select via Windows Terminal, but breaks normal copy/paste flow.

Activity

  1. opencodejr commented on Nov 23, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. A few details would help narrow this down:

    1. Where does Ctrl+V fail? Is it when pasting into a Windows app (Notepad, a browser) after selecting text in OpenCode, or when pasting into the OpenCode prompt? In the OpenCode prompt, Ctrl+V is bound to prompt.paste, which reads the clipboard itself, so it can fail separately from copying. If it's the prompt, does Ctrl+Shift+V (Windows Terminal's own paste) work there?
    2. Which version worked? Please give the exact version you ran before upgrading (for example 2.4.0 or a 2.3.x). If you can, run that version again to confirm it still works on the same machine.
    3. Does DISPLAY=:0 opencode change anything? A comment on TUI: "Copied to clipboard" toast shown even when nothing was copied (OSC52 "attempted" treated as success) #59664 reports that this made copying reach the Windows clipboard in one WSL setup.

    About the mouse wheel with "mouse": false: you can still scroll the transcript with the keyboard. session.page.up is bound to pageup and ctrl+alt+b, and session.page.down to pagedown and ctrl+alt+f.

    You can reply here with the details or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know when you're done.

    Related issues, ordered by likelihood:

  2. added
    area/tui
    platform/wsl
    type/bug
    version/v2
    on Nov 23, 2026
  3. virafb commented on Nov 23, 2026

    @virafb
    Author

    Additional test: installed xclip inside WSL2 Ubuntu 26.04.1 LTS; selecting text in v2.4.1 still shows "Copied to clipboard" while Ctrl+V does not paste.

  4. weboliver commented on Nov 24, 2026

    @weboliver

    with opencode --log-level debug - Clipboard works // Strange

    I downgraded and wait: opencode upgrade 2.3.2 && opencode service restart

  5. PhonezM commented on Nov 25, 2026

    @PhonezM

    Opened #66310 with a fix: when the native host clipboard does not write on WSL, the TUI now writes through powershell.exe interop before trusting the OSC 52 result, and reports an error instead of a false toast when that fails too.

  6. virafb commented on Nov 26, 2026

    @virafb
    Author

    Answers to the follow-up questions:

    1. Where Ctrl+V fails: Both — pasting into Windows apps and pasting into the OpenCode prompt both fail (the Windows clipboard is not updated).
    2. Last working version: v2.3.2. After downgrading back to v2.3.2 on the same machine, copy/paste works fine again.
    3. DISPLAY=:0: DISPLAY=:0 was already set in the environment when v2.4.1 failed.
  7. menschenfracht commented on Dec 1, 2026

    @menschenfracht

    Same on v2.4.3 (Windows Terminal 1.25.3131, WSL2 Ubuntu 26.04, WSLg), so the latest release still has it.

    Two extra details:

    • After a drag-select in the TUI the Windows clipboard isn't just stale, it's emptied: Get-Clipboard -Raw returns nothing, while "Copied to clipboard" appears.
    • OSC 52 works here: printf '\033]52;c;<base64>\a' in a plain tab reaches the Windows clipboard, and Shift+drag → Ctrl+C also works.

    Happy to test a build from #66641 on this machine.

  8. neriousy commented on Dec 2, 2026

    @neriousy
    Member

    Thanks for the report! This looks like the same bug as #59664, so I'm closing this one to keep the discussion in one place. If yours turns out to be different, leave a comment and we'll reopen it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/tuiplatform/wsltriagingtype/bugversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions