Skip to content

Mouse selection is very unreliable and drives me nuts (vscode terminal) #15760

Closed
anomalyco/opentui
#772

Description

@jdanbrown

Description

I'm not sure exactly when this started, but it feels like it used to work better a month or two ago. When I click and drag to select text in the opencode cli output, most of the time it fails to register which results in no drag selection. So I have to do it again, and again, and again. Drives me totally bananas!

This bug happens in vscode terminal (where I like to use terminals), and when I test in iterm2 mouse selection works normally (I tried clicking a bunch back and forth between two splits in iterm2 and I couldn't get the bug to happen even once). Here's a screen recording in vscode terminal showing the bug:

Screen.Recording.2026-03-02.at.1.58.13.PM.mov

TUI config:

$ cat ~/.config/opencode/tui.jsonc
{
  "$schema": "https://opencode.ai/tui.json",
  "scroll_acceleration": {
    "enabled": true,
  },
  "diff_style": "stacked",
  "theme": "jdanbrown",
  "keybinds": {
    "leader": "ctrl+o",
    "app_exit": "ctrl+d,<leader>q",
    "session_timeline": "<leader>t",
    "session_child_cycle": "ctrl+alt+j",
    "session_child_cycle_reverse": "ctrl+alt+k",
    "messages_line_up": "ctrl+alt+y",
    "messages_line_down": "ctrl+alt+e",
    "messages_half_page_up": "ctrl+alt+u",
    "messages_half_page_down": "ctrl+alt+d",
    "messages_first": "ctrl+g",
    "messages_last": "ctrl+alt+g",
    "messages_next": "ctrl+alt+e",
    "messages_previous": "ctrl+alt+y",
    "model_list": "<leader>m,ctrl+m",
    "command_list": "ctrl+/,ctrl+_",
    "input_newline": "alt+enter,shift+enter,shift+return",
    "history_previous": "up,ctrl+p",
    "history_next": "down,ctrl+n",
  },
}

Plugins

none

OpenCode version

1.2.15

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS 26.2

Terminal

vscode terminal

Activity

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

    @github-actions
    Contributor

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

    If your issue is distinct from the above, please add a comment explaining how it differs so maintainers can keep both open.

  3. kommander commented on Mar 2, 2026

    @kommander
    Contributor

    I see that happen as well in Ghostty, so it might not be terminal specific and I am sure it was better at some point. I tried to reproduce the issue with tests, but didn't succeed. I need to track this down.

  4. simonklee commented on Mar 2, 2026

    @simonklee
    Member

    Independent of terminal, it also matters where you start the selection. I'm not saying this is the only issue - but it's one issue.

    select.mp4
  5. jdanbrown commented on Mar 2, 2026

    @jdanbrown
    ContributorAuthor

    @kommander I narrowed down my repro: It doesn't happen in opencode 1.1.59 (Feb 11) but does happen in opencode 1.1.60 (Feb 12). That implicates one of the changes in opentui 0.1.77 → 0.1.79:

    Here's the opus-4.6 chat that searched through the opentui commits to find this:

  6. jdanbrown commented on Mar 2, 2026

    @jdanbrown
    ContributorAuthor

    Fwiw, in my opus-4.6 chat above it claims "VSCode terminal batches multiple mouse escape sequences into a single stdin read", in case that's a helpful lead on why this happens in vscode terminal and ghostty but not iterm2.

  7. kommander commented on Mar 2, 2026

    @kommander
    Contributor

    I've identified the exact commit in opentui: anomalyco/opentui@f91df10#diff-b67baa356adfb0988914fac554870cbf24924353189eb32933b549b9da71f478

    Will have a closer look and get it fixed. Then selection should actually work just properly in vscode, as far as I could test at least.

  8. simonklee commented on Mar 3, 2026

    @simonklee
    Member

    I've identified the exact commit in opentui: anomalyco/opentui@f91df10#diff-b67baa356adfb0988914fac554870cbf24924353189eb32933b549b9da71f478

    Will have a closer look and get it fixed. Then selection should actually work just properly in vscode, as far as I could test at least.

    I think its because a chunk like \x1b[I\x1b[<0;10;5M (focus-in + mouse down) results in zero parsed mouse events right now with broken up input parsing

  9. jdanbrown commented on Mar 3, 2026

    @jdanbrown
    ContributorAuthor

    Thank you! This appears to be working better now in 1.2.16.

  10. damianhunziker commented on Jul 26, 2026

    @damianhunziker

    Did you also experience strange selection behavior outside of vscode? because I have! Fe in the dev tools of Firefox and Safari, can not copy out of the console, and rarely also in other places, it might just be different problems with other software, but somehow this whole thing is quite fishy.

    I have the strong feeling someone is doing this on purpose to force you to use another operating system. Vs code devs seem all to use windows, people reporting issues since 2019, it was never fixed... But they say it works better now on Windows!
    And fuck this behavior reminds me just to much of the times when your Windows 95 has been totally hacked down once again. Then it also used to behave like that!!

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis 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