[BUG] Agent View (via double-click left arrow) Esc exit causes CLI hang and terminal misalignment
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 running Claude Code in Windows 11 CMD, after entering the CLI via the claude command, double-clicking the left arrow key to open the Agent View and then pressing Esc causes Claude to hang for several seconds on the normal transcript before exiting entirely. Additionally, CMD exhibits terminal rendering/display misalignment artifacts after this sequence. However, launching directly into Agent View via claude agents and then exiting does not reproduce the display misalignment issue.
<img width="1722" height="153" alt="Image" src="https://github.com/user-attachments/assets/e569816d-16b6-4705-88e6-01084102a38a" />
What Should Happen?
Pressing Esc in Agent View launched by claude should dismiss the view and return to the normal chat interface without exiting Claude Code or causing any terminal rendering corruption.
<img width="1713" height="96" alt="Image" src="https://github.com/user-attachments/assets/6f61fcc9-14cc-4091-b303-b2bfafc7e2ca" />
Error Messages/Logs
Steps to Reproduce
- Open CMD on Windows 11
- Run
claudeto enter interactive CLI - Double-click left arrow key to navigate into Agent View
- Press
Escto exit Agent View - Observe: Claude hangs on the chat interface for several seconds, then exits completely
- Observe: CMD displays terminal misalignment/rendering artifacts after exit
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.161 (Claude Code)
Platform
Other
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
- The display misalignment only occurs when entering Agent View from the standard
claudecommand flow, not fromclaude agentsdirectly - Suspected root cause may be incomplete terminal state restoration (e.g., cursor position, alternate screen buffer) when transitioning between views via the
claudeentry point
Showing cached comments. Read the full discussion on GitHub ↗
3 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Also reproducible on macOS with the current version (2.1.214), so this is not Windows/CMD-specific. On macOS there is no hang or rendering corruption — pressing
Escin the Agent View simply quits Claude Code entirely and drops back to the shell prompt.Steps to reproduce
claudein interactive mode.Esc.Expected: Return to the session/main prompt. Per the agent view docs, Escape should only exit the agent view and return to the session; the only documented quit shortcut is Ctrl+D pressed twice within ~800ms.
Actual: Claude Code exits completely to the shell.
Environment
Fixed in 2.1.163 — changelog: "Fixed terminal misalignment and a multi-second hang when exiting the agent view by pressing Esc" (https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md). Closing — reply to reopen if it still happens on the latest version.
🤖 Generated with Claude Code