Mouse-tracking escape sequences leak into PowerShell prompt after terminal idle

Status Open
Maintainer reply None cached
Activity 1 comment · opened Sep 28, 2026

Description
After leaving a Claude Code session idle in Windows Terminal / PowerShell for a while, the session drops out to a bare PowerShell prompt (not the Claude Code TUI). The terminal is left in xterm SGR mouse-tracking mode (\e[?1000h-style), and since nothing is consuming the reports anymore, raw mouse-move reports get echoed into the PowerShell input line as literal text — e.g. repeating patterns like 29M[555;50;29M[555;49;.... Clicking doesn't clear it; each click just appends another mouse report.

Environment

  • OS: Windows 11 Enterprise 10.0.26100
  • Terminal: Windows Terminal / Windows PowerShell
  • Occurred twice so far

Steps to reproduce

  1. Start a Claude Code session in PowerShell.
  2. Leave the terminal idle for an extended period.
  3. Return to find a plain PowerShell prompt instead of the Claude Code UI, with garbled escape-sequence text flooding the input line.

Expected behavior
Claude Code should disable mouse tracking (send \e[?1000l/\e[?1003l/\e[?1006l etc.) before yielding the terminal back to a raw shell prompt, so stray mouse input doesn't get interpreted as typed text.

Screenshots
I have two screenshots showing the escape-sequence flood but gh CLI doesn't support attaching local images to issues — happy to attach via the web UI if useful, or reply here with a request.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗