anomalyco / anomalyco/opencode

TUI: mouse wheel never captured in iTerm2 (macOS) — wheel scrolls iTerm2's own scrollback instead of the conversation

Open
#49,622 1 comment 0 reactions 1 assignee View on GitHub

@simonklee is already working on this.

Since Sep 17, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

On macOS + iTerm2, the mouse wheel / trackpad never scrolls the OpenCode conversation transcript. Instead, iTerm2 scrolls its own native scrollback buffer — i.e., content from before opencode was even launched. The TUI appears to never enable mouse reporting in this environment, so wheel events fall through to the terminal emulator.

Debugging performed to isolate the cause:

  1. Config confirmed loading & applying~/.local/share/opencode/log/opencode.log shows at TUI startup:
    message="loading tui config" path=/Users/.../.config/opencode/tui.json
    message="applying tui config" path=/Users/.../.config/opencode/tui.json order=1
    
    with tui.json containing "mouse": true (also reproduced with scroll_acceleration enabled and with a plain scroll_speed).
  2. Not the scroll viewport — keyboard scrolling works perfectly (PageUp/PageDown, Ctrl+Alt+U/D, Ctrl+G), so transcript scrolling itself is functional; only the mouse layer is dead.
  3. Not iTerm2 configuration — no mouse/scroll overrides in the iTerm2 preferences; iTerm2 defers wheel events to any app that enables mouse reporting. Scrolling its own buffer is the standard behavior when the app hasn't claimed the mouse.
  4. No multiplexer — running directly in iTerm2, no tmux/screen.
Plugins
  • opencode-antigravity-auth@latest, opencode-anthropic-auth@latest, opencode-antigravity-web@latest, opencode-antigravity-img@latest, opencode-wakatime, oh-my-openagent@latest, oh-my-tokens, opencode-agents-sidebar@latest, opencode-autotitle@latest, opencode-log-sanitizer@latest, opencode-dynamic-context-pruning@latest
OpenCode version

1.18.31

Steps to reproduce
  1. iTerm2 3.7.2 on macOS 27.0 (build 26A428), default profile
  2. ~/.config/opencode/tui.json:
    {
      "$schema": "https://opencode.ai/tui.json",
      "mouse": true,
      "scroll_speed": 5,
      "scroll_acceleration": { "enabled": false }
    }
    
  3. Launch opencode, hold a conversation longer than one viewport
  4. Scroll wheel / two-finger trackpad over the conversation pane
Expected behavior

Wheel scrolls the conversation transcript inside the TUI.

Actual behavior

iTerm2 scrolls its native scrollback (pre-launch shell content); the TUI viewport doesn't move.

Operating System

macOS 27.0 (26A428), Apple Silicon

Terminal

iTerm2 3.7.2 (TERM_PROGRAM=iTerm.app)

Additional context

Possibly related (same class of wheel-event delivery failure, different terminals): #33032, #35295, #42501. If there's any low-level introspection that would help (e.g., verifying which DECSET mouse modes the TUI emits at startup), happy to run it — the environment is fully instrumented on my side.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.