Cursor buried in TUI remnants on exit (no alternate screen buffer)

Resolved 💬 1 comment Opened Apr 13, 2026 by meenie216 Closed May 24, 2026

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

  1. Open Claude Code in a terminal (claude)
  2. Have a conversation (any length)
  3. Exit with /exit or Ctrl+C
  4. 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

View original on GitHub ↗

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