[BUG] Mouse tracking not disabled when Claude Code is suspended with Ctrl-Z
Status Open
Reported on v2.1.210
Maintainer reply ✓ Yes — bcherny
Workaround ✓ Mentioned in thread ↓
Activity 3 comments · opened Jul 15, 2026
💡 Likely answer: A maintainer (bcherny, collaborator)
responded on this thread — see the highlighted reply below.
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When Claude Code is suspended using Ctrl-Z, it leaves mouse tracking enabled in the terminal. This causes other terminal programs to receive unwanted mouse enter/exit events.
In my case, when i wanted to use the terminal scrollback, bash responds to scroll-events by cycling through the command history instead.
What Should Happen?
When Claude Code is suspended, it should disable mouse tracking so other terminal programs aren't affected.
Error Messages/Logs
Steps to Reproduce
- Open a fresh terminal (using xfce4-terminal)
- ls -R | head -1000
- Start Claude Code
- Suspend Claude Code with Ctrl-Z
- Scroll up (attempt to skim through old terminal output)
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.210 (Claude Code)
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
I've confirmed this only for xfce4-terminal, not others. I doubt it's specific to xfce4-terminal.
This exact issue has been reported but then closed automatically.
I have
{
"env": { "CLAUDE_CODE_DISABLE_MOUSE_CLICKS": "1" },
"tui": "fullscreen",
"editorMode": "normal",
/* ... */
}
3 Comments
Confirming this on a completely different terminal + shell, which supports your hunch that it isn't xfce4-terminal-specific:
Same failure, different surface symptom: after suspending Claude Code with Ctrl-Z, a touchpad/wheel scroll pops open atuin's history search instead of scrolling kitty's scrollback. atuin binds the Up arrow, which is the tell for the underlying mechanism.
Mechanism: while running, Claude Code enables mouse/scroll reporting (and leaves alternate-scroll behaviour on). With that mode still active, kitty stops treating a wheel event as "scroll the scrollback" and instead forwards it to the foreground program as cursor-key input (scroll up →
Up, scroll down →Down). Those arrows land in zle, and atuin's Up binding catches them — exactly the same class of bug as bash cycling its command history in the original report.Why a clean exit is fine but Ctrl-Z isn't: quitting Claude normally runs its terminal-restore path, which sends the reset sequences and hands scrollback back to the terminal.
Ctrl-ZraisesSIGTSTPand stops the process immediately, so that restore never runs and the modes are left enabled. This is the specific case of the more general #78690 (TUI doesn't restore terminal state on SIGTSTP) — aSIGTSTP/SIGCONThandler that saves and restores terminal modes would fix both.Userland workaround (zsh) — zsh runs
precmdhooks when it regains control after a suspend, so re-disabling the modes there heals the terminal the moment you land back at the prompt. Harmless at a normal prompt, and a real Up keypress still opens atuin:Version: Claude Code 2.x, macOS.
Still present in 2.1.228 (reported here against 2.1.210), on a different platform and without
CLAUDE_CODE_DISABLE_MOUSE_CLICKSset:"tui": "fullscreen"in settings.jsonCLAUDE_CODE_DISABLE_MOUSE_CLICKSnot setSame symptom: after Ctrl+Z, the scroll wheel cycles zsh history instead of scrolling scrollback. Persists for the life of that terminal; a new terminal is unaffected;
resetclears it.So this isn't specific to xfce4-terminal or to
CLAUDE_CODE_DISABLE_MOUSE_CLICKS.Worth noting that exiting Claude Code normally restores the terminal correctly — the teardown path works, it just isn't wired to the suspend path.
Thanks for the detailed repro — confirmed on 2.1.233 (Linux).
One correction to the mechanism: capturing the terminal output during Ctrl-Z shows Claude Code does disable mouse tracking (and focus reporting, bracketed paste) right before suspending, and re-enables it on
fg— on both 2.1.210 and 2.1.233. What it doesn't do is leave the fullscreen alternate screen, so your shell prompt lands inside it while Claude Code is suspended. In VTE-based terminals like xfce4-terminal, scrolling the wheel in the alternate screen sends Up/Down arrow keys — which is exactly why bash cycles through history instead of the terminal scrolling back, and why your earlierls -Routput is unreachable.So: confirmed bug, just with a different cause than the title suggests — suspend should also leave the alternate screen and re-enter it on resume (like vim/less do). Reproduced consistently on 2.1.233.
Workaround in the meantime: launch with
CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1to use the native-scrollback renderer, which avoids this entirely.🤖 Generated with Claude Code