# xterm.js PR #6059 patch for wanix Fixes mobile touch scrolling emitting garbage into the terminal: the touch fling inertia (momentum) frames created `change` gesture events without client coordinates, which the mouse-report wheel path serialized as `CSI < 64 ; NaN ; NaN M`, read back by the app as garbage input. Two changes (from https://github.com/xtermjs/xterm.js/pull/6059, adapted to the `@xterm/xterm@6.1.0-beta.303` that wanix pins): 1. `src/browser/scrollable/touch.ts` - `_inertia()` now stamps extrapolated `pageX/pageY/clientX/clientY` on momentum-frame gesture events. 2. `src/browser/services/MouseService.ts` - `_handleTouchScrollAsWheel()` drops gesture events whose coordinates are not finite, instead of emitting a NaN mouse report. ## Files | File | What it is | | --- | --- | | `wanix.min.js` | patched production bundle, replace `wanix/dist/wanix.min.js` | | `wanix.js` | patched dev bundle (same fix, non-minified) | | `xterm.mjs` | patched `@xterm/xterm` ESM lib, `node_modules/@xterm/xterm/lib/xterm.mjs` | | `xterm.js` | patched `@xterm/xterm` CJS lib, `node_modules/@xterm/xterm/lib/xterm.js` | ## How to use Quick replace (bundle): ```sh cp wanix.min.js /path/to/wanix/dist/wanix.min.js ``` Keep the fix across future wanix rebuilds (source of truth): ```sh cp xterm.mjs /path/to/wanix/node_modules/@xterm/xterm/lib/xterm.mjs cp xterm.js /path/to/wanix/node_modules/@xterm/xterm/lib/xterm.js cd /path/to/wanix && ESBUILD=esbuild ./js.sh ``` ## Verification Behavioral tests ran against the actual patched code (extracted from `xterm.mjs`): - inertia frame: `evt.clientX/clientY` are finite and equal the extrapolated page position minus window scroll; - wheel handler: a gesture event with `clientX=NaN` is dropped (no report, accumulator untouched); a finite event produces the expected wheel reports. Syntax-checked as ESM/CJS with `node --check`; `Terminal` still imports.