TUI applications flood chat with ANSI escape sequences

Resolved 💬 4 comments Opened Dec 18, 2025 by girste Closed Feb 14, 2026

Description

When running Terminal User Interface (TUI) applications, ANSI escape sequences are captured and displayed in the chat interface, making it unusable.

Steps to Reproduce

  1. Run any TUI application using frameworks like Textual or prompt_toolkit
  2. Example: python main.py where main.py launches a Textual app
  3. Observe the chat interface

Expected Behavior

  • TUI applications should run in an isolated terminal view
  • ANSI escape sequences should be interpreted by the terminal, not displayed as text
  • Chat interface should remain clean and usable

Actual Behavior

  • Chat fills with ANSI escape sequences like:
  • [?1049h (alternate screen buffer)
  • [1;1H (cursor positioning)
  • [48;2;0;0;0m (RGB color codes)
  • [?1000h, [?1003h (mouse tracking)
  • The chat becomes unreadable
  • Interface becomes buggy/unusable

Example Output

When running a Textual-based TUI app, the stderr output contains 70+ lines of escape sequences per frame update.

Environment

  • OS: macOS
  • Claude Code version: 2.0.72
  • TUI Frameworks tested: Textual 0.45.1+

Suggested Fix

TUI applications should either:

  1. Run in a separate PTY that properly handles ANSI codes
  2. Have their output filtered to prevent escape sequences from reaching the chat
  3. Be detected and launched in a dedicated terminal viewer

View original on GitHub ↗

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