Windows Terminal rendering broken after /statusline - scroll margins not reset

Resolved 💬 5 comments Opened Dec 19, 2025 by StevenD27 Closed Feb 14, 2026

Bug Report: Windows Terminal Rendering Issues After /statusline

Environment

  • OS: Windows 11 (MSYS_NT-10.0-26200)
  • Terminal: Windows Terminal / PowerShell
  • Claude Code Version: v2.0.73
  • Model: Opus 4.5

Summary

After running /statusline command, terminal rendering is broken in PowerShell/Windows Terminal. Content is missing, truncated, or overwritten. The issue does NOT occur in CMD.

Symptoms

Symptom 1: Last line of output hidden

  • When displaying 10 lines of text, line 10 is not visible
  • Works correctly in CMD
  • Caused by DECSTBM scroll margins not being reset

Symptom 2: Content in middle of output missing

  • Insight sections partially rendered
  • Lines appear truncated on the left side
  • Content appears fragmented (e.g., "before the next batch." floating without context)

Symptom 3: Lines 1-9 hidden, only line 10 visible

  • Asked for 10-line output
  • Only the last line rendered
  • Previous lines completely missing

Root Cause Analysis

  1. Scroll Margins (DECSTBM): The /statusline feature uses ESC[<top>;<bottom>r to reserve the bottom line. These margins are NOT properly reset when statusline fails or is disabled on Windows Terminal.
  1. Cursor Manipulation: Claude Code uses ANSI escape codes (\033[F move up, \033[K clear line) that overwrite previous content on Windows.
  1. ConPTY Differences: Windows Terminal uses ConPTY which maintains ANSI state (including scroll margins), while CMD's legacy console often resets them.

Reproduction Steps

  1. Start Claude Code in Windows Terminal (PowerShell)
  2. Run /statusline
  3. Exit or disable statusline
  4. Ask Claude to output 10 lines of text
  5. Observe: last line (or multiple lines) are hidden

Partial Workaround Found

Resetting scroll margins with:

[Console]::Write([char]27 + "[r")

This fixes the "last line hidden" symptom but does NOT fix the content overwriting/truncation issues.

Related Issues

  • #4897 - Console output overwritten on Windows (CRITICAL)
  • #8618 - CLI Terminal UI Rendering Corrupted (SHOW-STOPPER)
  • #14125 - StatusLine not rendering in Windows Terminal
  • #6526 - StatusLine not displaying on Windows 11

Expected Behavior

  • All output lines should be visible
  • Content should not be truncated or overwritten
  • /statusline should properly clean up terminal state when disabled

Suggested Fix

  1. Reset scroll margins (ESC[r) when statusline is disabled
  2. Consider disabling cursor manipulation ANSI codes on Windows
  3. Test terminal state cleanup on Windows Terminal specifically

View original on GitHub ↗

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