[BUG] Canceling ExitPlanMode leaves terminal output broken
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?
If I press ESC to cancel while Claude is prompting me to review/approve a plan in Plan Mode, I am left with broken terminal output.
Claude Code returns to the normal conversation view, but dumps the plan that it had prompted the user to approve into the conversation history wrapped in a blue box. However, on all recent versions of Claude Code, if the plan exceeds the terminal window height, which occurs often, only the part of the plan that fits on the screen is printed correctly. If the user attempts to scroll up and read the entire plan, they encounter a garbled mix of the original "exit plan" dialog, the previous conversation transcript, and the new transcript containing the "User rejected Claude's plan" box.
This renders the history borderline unusable.
<img width="874" height="737" alt="Image" src="https://github.com/user-attachments/assets/f58f5baf-8ef9-402e-bc4d-9546eae7fa43" />
What Should Happen?
Claude Code should print the full last turn's message, including the full "User rejected Claude's plan" box with the plan in its entirety into the terminal window and its scrollback.
Ideally, Claude Code should offer a configurable option to restore the previous behavior (prior to 2.1.97) of clearing and redrawing the entire scrollback, so users always have a cohesive conversation history in their terminal scrollback.
For users that don't want the scrollback clearing behavior, when Claude Code clears a dialog or other temporary display state that extends into the scrollback buffer, it should either first push the text in the display region into the scrollback, or push a highly visible "dividing line" or other visual element into the scrollback, so users can tell where one cohesive display ends and another begins.
Error Messages/Logs
Steps to Reproduce
- Launch Claude Code and start a plan mode session. The plan must be longer than the terminal window height for the issue to be visible.
- When Claude prompts you review the plan and exit plan mode, press ESC
- Scroll up and attempt to read the scrollback buffer
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.97
Claude Code Version
2.1.165
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Screenshot displays the issue in Ghostty, but it reproduces in iTerm2 as well.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗