Skip to content

fix(terminal): support touch scrolling in TUI apps - #49

Merged
LukeGus merged 4 commits into
Termix-SSH:dev-1.5.0from
ZacharyZcR:fix/tui-touch-scroll
Aug 14, 2026
Merged

fix(terminal): support touch scrolling in TUI apps#49
LukeGus merged 4 commits into
Termix-SSH:dev-1.5.0from
ZacharyZcR:fix/tui-touch-scroll

Conversation

@ZacharyZcR

Copy link
Copy Markdown
Member

Summary

  • translate terminal swipe gestures through xterm wheel handling
  • support normal scrollback and alternate-screen TUI mouse/arrow sequences
  • prevent the WebView page from stealing terminal gestures
  • preserve text-selection gestures
  • keep xterm stdin disabled except during synchronous wheel dispatch, preventing duplicate React Native keyboard/IME input

This extracts the touch-scroll work from #39 onto dev-1.5.0. The original commits remain authored by Tink (goxofy), with an additional stdin-isolation fix. Viewport sizing is handled independently in #48.

Verification

  • npx tsc --noEmit
  • targeted ESLint (0 errors; existing warnings only)
  • npm run format:check
  • git diff --check

Supersedes the touch-scroll portion of #39.

Tink and others added 4 commits August 13, 2026 06:19
The previous touch handler called terminal.scrollLines(), which is a no-op on
the alternate screen buffer that TUI apps run in, so swiping did nothing
inside Claude Code / Codex. Synthesize a wheel event on the xterm root
element instead: xterm routes it to the scrollback in the normal buffer, or
to SGR mouse sequences / arrow keys in the alternate buffer, which TUIs
understand. Enable stdin in the WebView and bridge xterm onData back to the
pty via a new 'input' WebView message so the synthesized wheel bytes reach
the shell. Keyboard input is unaffected (it goes through the RN IME).

Co-Authored-By: Claude <noreply@anthropic.com>
When swiping up in a TUI app to return to the newest content, the native
touch scroll of .xterm-viewport bubbled to the WebView page when the
alternate buffer was at its top, scrolling the whole page instead of the
terminal. Disable native touch-scrolling at the source with touch-action:
none on the terminal elements (including .xterm-screen, the actual touch
hit-target), so the synthetic WheelEvent remains the sole scroll driver.
Works on both iOS WKWebView and Android WebView.

Co-Authored-By: Claude <noreply@anthropic.com>
touch-action:none alone is not enough on iOS WKWebView: a passive
touchmove still lets the page steal the gesture when the alt buffer is
already at its top, so the whole terminal slides instead of the content.
Make the scroll touchmove non-passive, call preventDefault (skipping only
when text selection is active), disable WebView scrollEnabled, and pin
.xterm-viewport overflow so the synthetic WheelEvent remains the only
scroll driver.

Co-Authored-By: Claude <noreply@anthropic.com>
@LukeGus
LukeGus merged commit 769a0b5 into Termix-SSH:dev-1.5.0 Aug 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants