[Bug] Claude Code captures mouse events in tmux, making scrollback completely unusable
Resolved 💬 3 comments Opened Mar 25, 2026 by stilletto Closed Mar 29, 2026
Preflight Checklist
- [x] I have searched existing issues and confirmed this is not a duplicate
- [x] I am on the latest version of Claude Code
- [x] I can reproduce this issue consistently
Bug Description
When running Claude Code inside tmux, the TUI scrollbar disappears and scrolling breaks completely.
Without tmux (normal terminal):
- Claude Code TUI shows a scrollbar on the right side of the conversation output
- Mouse wheel scrolls the conversation history (previous messages, tool results, etc.)
- Works perfectly
Inside tmux:
- The scrollbar disappears entirely
- Mouse wheel scrolls the input box history (like pressing arrow up/down), cycling through previous commands instead of scrolling conversation output
- There is no way to scroll the conversation output — only the very bottom is visible
tmux set -g mouse on/offdoesn't help in either mode
This also affects other similar TUI tools (e.g. OpenAI Codex CLI has the same issue in tmux).
Steps to Reproduce
- Start tmux:
tmux new-session -s test - Run Claude Code:
claude - Ask Claude something that produces long output
- Try to scroll up with mouse wheel
- Expected: conversation history scrolls up with scrollbar visible (as it works outside tmux)
- Actual: input box cycles through command history (like arrow up/down), no scrollbar, conversation output not scrollable
Root Cause
The TUI appears to detect different terminal capabilities when running inside tmux ($TMUX is set), falling back to a degraded mode where:
- The scrollbar component is not rendered
- Mouse wheel events are routed to input history navigation instead of conversation viewport scrolling
This is likely related to how the Ink framework handles alternate screen buffer and mouse tracking inside tmux. tmux intercepts certain escape sequences for mouse event handling, which breaks the TUI's ability to receive and process scroll events for its own viewport.
Proposed Solution
- Detect tmux environment and ensure the scrollbar still renders and mouse wheel routes to conversation viewport
- Or add a config option / CLI flag (e.g.
--no-mouseordisableMouseCapturein settings) to disable mouse capture, letting tmux handle scrollback natively - Or provide a keyboard shortcut for scrolling conversation output (e.g. Page Up/Down) that works regardless of terminal environment
Environment
- OS: Linux (WSL2 - Ubuntu)
- Terminal: Windows Terminal → WSL2 → tmux 3.x
- Claude Code: latest version
Related Issues
- #15780 (feature request for tmux scroll support, marked stale)
- #9902 (mouse scroll in tmux)
- #23581 (disable mouse tracking request)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗