[BUG] Thinking spinner causes terminal content to jump/flicker in tmux (main buffer instead of alternate screen)

Resolved 💬 2 comments Opened Apr 22, 2026 by guxi11 Closed Apr 23, 2026

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?

Environment

  • Claude CLI (latest)
  • tmux inside Emacs vterm (also reproducible in any terminal emulator with tmux)

Description

When Claude is in thinking/streaming mode, the terminal content visibly jumps. The bottom of the pane gains and loses one blank line repeatedly, causing entire content to scroll.

Root Cause

Claude CLI uses Ink.js which does not use alternate screen (smcup/rmcup) by default. It writes directly to the main buffer:

  1. Spinner appends a new line → triggers scroll region → all content shifts up 1 line
  2. Spinner erased with \033[A\033[2K → blank line at bottom momentarily
  3. Terminal redraws → visible jump

In tmux this is amplified by tmux's own redraw cycle.

Why Hard to Work Around

  • vterm (Emacs): process filter hardcoded in C, no raw output hook exposed to Emacs Lisp
  • pty wrapper: causes buffering/latency issues
  • tmux status-position top: reduces severity but doesn't fix root cause

Reference

Google Gemini CLI (also Ink.js-based) has already implemented alternate screen and achieves flicker-free rendering. Fix is feasible.

Suggested Fix

process.stdout.write('\x1b[?1049h'); // enter alternate screen
// ... TUI lifecycle ...
process.stdout.write('\x1b[?1049l'); // exit alternate screen

What Should Happen?

Tmux pane should not jump/flicker when claude is thinking.

Error Messages/Logs

Steps to Reproduce

  1. Open new vterm buffer in Emacs
  2. Create a new claude session in the vterm buffer
  3. Interact with claude

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

2.1.112

Claude Code Version

2.1.112

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗