[BUG] Touch swipe spams NaN;NaNM into focused prompt input (Surface Pro / Windows Terminal, fullscreen TUI, still on 2.1.251)
Bug description
On a touchscreen device (Surface Pro), swiping to scroll the chat in the Claude Code TUI spams repeated NaN;NaNM text into the prompt input:
aN;NaNMaN;NaNMaN;NaNMaN;NaNMaN;NaNMaN;NaNMaN;NaNMaN;NaNM...
These look like SGR mouse-report escape sequences (\e[<b;x;yM) whose coordinates were computed as NaN, leaking into the input box as literal text.
v2.1.251's changelog entry — "Fixed text like <35;150;7M being inserted into the prompt when a mouse report arrived split across reads" — does not cover this variant: it still reproduces on 2.1.251.
Key observation: only happens when the prompt input is focused
- Input focused → swiping spams
NaN;NaNMinto the input box. - Input not focused (menu/dialog open) → swiping scrolls fine, no spam.
So the scroll handling itself copes with the touch events; it's the input echo path that receives the malformed/NaN sequences as typed characters. Possible mitigations from a user's perspective: suppress input echo while a mouse/touch drag is in progress, or allow tapping outside the input to unfocus it.
(The same failure shape reproduces in other TUI agents on the same device, so the trigger is likely how Windows Terminal reports touch-drag events, but the NaN coordinates and the echo-through appear to be client-side parsing.)
Environment
- Claude Code: 2.1.251
- OS: Windows 11 Home 10.0.26200
- Device: Microsoft Surface Pro (touchscreen)
- Terminal: Windows Terminal
- Settings:
"tui": "fullscreen"
Steps to reproduce
- Run
claudewith the fullscreen TUI on a touchscreen Windows device. - Make sure the prompt input is focused (normal idle state).
- Swipe up/down on the chat area with a finger.
NaN;NaNMrepeats flood the input box.
Workaround
CLAUDE_CODE_DISABLE_MOUSE=1 stops the spam entirely (at the cost of Claude Code's own mouse scrolling).