Forward touch scroll events as terminal input#2708
Open
splch wants to merge 3 commits intoish-app:masterfrom
Open
Forward touch scroll events as terminal input#2708splch wants to merge 3 commits intoish-app:masterfrom
splch wants to merge 3 commits intoish-app:masterfrom
Conversation
Member
|
This feels too independent from hterm. Surely hterm already supports passing scroll events? iSH should reuse that as much as possible |
Author
Great point i'm looking into this right now |
dad428c to
529d715
Compare
Dispatches synthetic WheelEvents into hterm's existing onMouse_ pipeline so touch scroll gestures reach programs that listen for them. hterm handles mouse reporting (VT) and alternate screen arrow keys (DECSET 1007) automatically. On the primary screen with mouse reporting disabled, the existing visual scrollback behavior is preserved unchanged. Fixes ish-app#2375 Fixes ish-app#2537
529d715 to
d501ca9
Compare
Purely additive change to term.js — no existing code modified.
Author
|
Note: Synthetic WheelEvents use default clientX/clientY (0, 0), so mouse wheel reports always map to terminal coordinates (1, 1). This works fine for scrolling in tmux, vim, less, etc., but programs that need accurate scroll position won't get it |
Manho
added a commit
to Manho/ish
that referenced
this pull request
Mar 24, 2026
…apps When a full-screen TUI (e.g. Claude Code, vim, less) uses the alternate screen buffer, UIScrollView has no scrollable content and scrollViewDidScroll: never fires. This means touch swipe gestures are silently dropped instead of reaching the remote program. Changes: - Add UIPanGestureRecognizer to detect vertical swipes independently of UIScrollView's scroll state - Call exports.handleScrollDelta() from the pan gesture only, removing it from scrollViewDidScroll: to prevent spurious events on keyboard show/hide layout changes - Add exports.handleScrollDelta() in term.js (from PR ish-app#2708) which dispatches synthetic WheelEvents into hterm's mouse pipeline; hterm forwards them as xterm mouse scroll sequences when mouse reporting is active or on the alternate screen This enables touch scroll to work in tmux copy mode, allowing users to scroll through conversation history in Claude Code and similar TUIs.
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.
Dispatches synthetic
WheelEvents into hterm's existingonMouse_pipeline so that touch scroll gestures reach programs that listen for them.When mouse reporting is active (e.g. tmux
set -g mouse on), hterm'sVT.onTerminalMouse_generates the appropriate escape sequences. When on the alternate screen (less, vim, man), hterm's built-in alternate scroll mode (DECSET 1007) sends arrow keys. On the primary screen with no mouse reporting, the handler is a no-op and existing scrollback behavior is unchanged.Changes
TerminalView.m: compute scroll delta inscrollViewDidScroll:and forward to JSterm.js: addhandleScrollDeltaexport that dispatchesWheelEvents toscrollPort_.screen_Test plan
set -g mouse on: touch scroll enters copy-mode and scrollsless/man: touch scroll moves through contentFixes #2375
Fixes #2537