Repository navigation
Release v0.7.1 - Fix mouse wheel scrolling with Claude Code
MAJOR FIX: Mouse wheel scrolling now works with TUI apps!
Root Cause (from Gemini/ChatGPT analysis):
- Claude Code uses alternate screen buffer (DECSET ?1049h)
- Claude Code enables mouse reporting mode (DECSET 1000/1002/1006)
- In this mode, xterm.js forwards wheel events to app instead of scrolling viewport
- Our auto-scroll logic was also fighting manual scroll attempts
Solution Implemented:
-
Custom wheel handler (Option A):
- Detects alternate buffer with term.buffer.active.type
- Sends arrow key sequences (\x1b[A / \x1b[B) to PTY on wheel
- Allows Shift+Wheel to force terminal scrollback
- 3-5 arrow keys per scroll tick for smooth scrolling
-
Smart auto-scroll (Option D):
- Only auto-scrolls if user hasn't manually scrolled up
- Tracks scroll position with onScroll handler
- Re-enables when user returns to bottom
- Prevents fighting manual scrolling
-
Debug logging:
- Logs buffer type changes to console
- Helps validate fix is working
Testing:
- Start: term-wrapper web claude
- Mouse wheel: scrolls Claude output (sends arrow keys)
- Shift+wheel: scrolls terminal history (bypasses app)
- Console: shows "Buffer type: alternate/normal"
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com