[BUG] Leading whitespace in user input not displayed in TUI (data reaches Claude correctly)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When typing a prompt with leading whitespace (spaces/tabs at the beginning of a line), the TUI does not display the indentation. The prompt appears to start at column 0.
However, the whitespace is correctly sent to Claude — the model can see the indentation. This is purely a TUI rendering issue.
Example:
- User types:
hogehoge(4 spaces before "hogehoge") - TUI displays:
hogehoge(no leading spaces visible) - Claude receives:
hogehoge(correctly includes spaces)
What Should Happen?
Leading whitespace should be displayed in the TUI, matching what the user typed and what Claude receives.
Error Messages/Logs
None — no errors, just visual discrepancy.
Steps to Reproduce
- Start Claude Code in interactive mode
- Type a message with leading spaces:
test(4 spaces before "test") - Observe: The TUI renders the prompt without the leading spaces
- Submit the message and ask Claude: "Did my message start with spaces?"
- Claude confirms it received the spaces, proving the issue is TUI-only
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
N/A
Claude Code Version
2.1.22
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
Related issue: #18774 reports indentation stripped when passing prompt as CLI argument. That issue involves data loss (spaces don't reach Claude). This issue is different — the data reaches Claude correctly, but the TUI doesn't render it.
---
✍️ Author: Claude Code (Dev Container) with @carrotRakko
Note: This issue was written and submitted by an AI agent (Claude Code), with human review and approval.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗