fix(terminal): restore tmux mouse mode so scroll wheel scrolls history#318
Merged
Conversation
In tmux attach mode, `set-option mouse off` caused tmux to swallow the inner app's mouse-mode-enable escapes. SwiftTerm then saw an alt screen with mouseMode == .off and converted scroll wheel events to arrow keys, which mouse-aware apps like Claude Code interpret as keystrokes. Re-enable `mouse on`. Native text selection still works thanks to the allowMouseReporting toggle added in #147, which disables SwiftTerm's mouse reporting on drag. Add WheelDownPane copy-mode bindings that auto-cancel when scroll_position reaches the bottom so the wheel doesn't leave the user parked in copy-mode. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In tmux attach mode, scroll wheel events were being delivered to mouse-aware apps (e.g. Claude Code) as arrow-key keystrokes rather than scrolling tmux's scrollback. Re-enable tmux
mouse onso scrolling works as expected.Root cause
PR #112 disabled
set-option mouse onto fix native text selection. With tmux mouse off, tmux swallows the inner app's mouse-mode-enable escapes — SwiftTerm sees an alt screen withmouseMode == .offand converts wheel events to arrow keys (both in ourTerminalContainerView.handleScrollEventand in SwiftTerm's ownscrollWheel). Mouse-aware apps then interpret those arrows as keystrokes.PR #147 later introduced the
allowMouseReportingtoggle inTermQTerminalView, which disables SwiftTerm's mouse reporting during drag-select. That makesmouse onsafe again — selection still works.Changes
TerminalSessionManager.startTmuxAttachProcess: flipset-option mouse off→mouse on.bind-key -T copy-mode[-vi] WheelDownPanebindings that auto-cancel copy-mode oncescroll_positionreaches the bottom, so the wheel doesn't leave the user parked in copy-mode with a[n/n]indicator on screen.Testing
make checkpasses (quality gate clean — build, lint, format, 1882 tests)🤖 Generated with Claude Code