Cursor buried in TUI remnants on exit (no alternate screen buffer)
Description
When Claude Code exits, the TUI content is left on screen and the cursor ends up buried within it rather than appearing cleanly at a new prompt. This makes it difficult to find where to type next.
The root cause appears to be that Claude Code doesn't use the terminal alternate screen buffer (smcup/rmcup escape sequences). TUI applications that use the alternate screen restore the original terminal state on exit — cursor position and all. Without it, the TUI output stays on screen and the cursor is left wherever the TUI last rendered it, often mid-block within the output.
Steps to Reproduce
- Open Claude Code in a terminal (
claude) - Have a conversation (any length)
- Exit with
/exitor Ctrl+C - Observe that the TUI content remains on screen and the cursor is buried within it
Expected Behaviour
Either:
- Claude Code uses the alternate screen buffer so the terminal is fully restored on exit (preferred — consistent with other TUI apps like
vim,htop,lazygit), or - The cursor is at minimum moved to a clean position below the output on exit
Actual Behaviour
TUI content remains on screen. Cursor is left buried within the rendered TUI text, making it hard to find the prompt.
Environment
- OS: Linux (Ubuntu)
- Terminal: GNOME Terminal
- Claude Code: CLI
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗