[BUG] Raw ANSI escape codes shown in prompt header bar instead of being stripped
Resolved 💬 2 comments Opened Apr 13, 2026 by harrisliangsu Closed May 25, 2026
Description
When Claude Code captures the shell prompt to display in the header/title bar area of the TUI, raw ANSI escape codes are shown as literal text instead of being rendered as colors or stripped out.
Example
The header bar displays:
# liangsu @ machine in ~/project on \033[34mgit\033[0m:\033[36mfeat/my-branch\033[0m \033[31mx\…
Instead of the expected clean text:
# liangsu @ machine in ~/project on git:feat/my-branch x
Environment
- OS: macOS (Darwin 25.4.0)
- Shell: zsh with oh-my-zsh
- Theme:
ys(uses%{$fg[blue]%}style color escapes in PROMPT) - Claude Code: latest CLI version
Expected behavior
The prompt header should either:
- Strip ANSI escape codes and display clean plain text, or
- Render the colors properly
Actual behavior
Raw escape sequences like \033[34m, \033[0m, \033[36m, \033[31m are displayed as literal text in the header bar.
Notes
- The terminal itself renders the prompt colors correctly — only the Claude Code TUI header is affected
- This likely affects all oh-my-zsh themes that use color escapes (ys, agnoster, robbyrussell, etc.)
- A simple regex strip of
\033\[[0-9;]*msequences before displaying would fix it
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗