Copy functionality broken after terminal ANSI escape sequences (Windows)

Resolved 💬 7 comments Opened Oct 2, 2025 by fatihaziz Closed Jan 8, 2026

Description

After running a command that outputs ANSI escape sequences (like terminal control codes), the copy functionality in Claude Code becomes corrupted. When attempting to copy any assistant response, the clipboard contains ANSI escape codes instead of the actual text.

Platform

  • OS: Windows (win32)
  • Claude Code version: Latest
  • Bun version: 1.2.21

Steps to Reproduce

  1. Run a command that outputs ANSI escape sequences (e.g., opencode command via direct .cmd execution)
  2. Terminal outputs escape codes like ]11;rgb:0c0c/0c0c/0c0c\
  3. Try to copy any assistant response text
  4. Paste clipboard - instead of text, get raw ANSI escape codes

Expected Behavior

Copy should extract clean text from responses, ignoring any ANSI sequences in the terminal output buffer.

Actual Behavior

Clipboard contains escape sequences like:

]11;rgb:0c0c/0c0c/0c0c\<0;45;20M<32;45;20M<0;45;20m

Impact

User cannot copy any responses, making Claude Code unusable until restart.

Workaround

Restart Claude Code to clear terminal state.

View original on GitHub ↗

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