Skip to content

Text selection stops working after copy-on-select triggers #14420

Closed as not planned

Description

@EliasHanken

Description

After selecting text by click-dragging (copy-on-select mode on Linux/macOS), the text is copied and the toast notification shows correctly. However, immediately trying to select more text often fails -- the selection doesn't start. You have to wait a bit before text selection works again.

The root cause is in Selection.copy() (selection.ts): it calls renderer.clearSelection() synchronously inside the onMouseUp handler, which runs during @opentui's processMouseEvent event bubbling -- before finishSelection() gets to execute. This nullifies currentSelection before the renderer can properly complete its selection lifecycle (setting isDragging=false, emitting the selection event), leaving stale internal state that blocks subsequent selections.

Plugins

None

OpenCode version

latest (dev)

Steps to reproduce

  1. Open OpenCode TUI on Linux or macOS (copy-on-select is enabled by default)
  2. Click-drag to select some text -- it copies and shows "Copied to clipboard" toast
  3. Immediately try to click-drag to select more text
  4. The selection often doesn't start on the first attempt
  5. Wait a moment, then try again -- it works

Operating System

Linux

Terminal

Various (not terminal-specific)

Activity

  1. nionis commented on Mar 4, 2026

    @nionis

    sometimes double clicking "esc" and then trying to select works, but it doesn't always work

  2. EliasHanken commented on Mar 5, 2026

    @EliasHanken
    Author

    sometimes double clicking "esc" and then trying to select works, but it doesn't always work
    Have noticed it, honestly the copy is a bit all over the place, often in bigger sessions it wont work at all i have experienced

  3. github-actions commented on May 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  4. richardokonicha commented on Oct 4, 2026

    @richardokonicha

    any update on this issue its a great pain

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