Custom status line strips leading whitespace from each row, breaking multi-line column alignment
Summary
A multi-line custom status line (statusLine.command) has the leading whitespace of each row stripped before it's drawn. Rows that begin with spaces — commonly used to align columns in a multi-row layout — get shifted left, which breaks column alignment.
The same bytes render correctly (leading spaces preserved) when printed straight to the terminal, so the stripping happens in Claude Code's status-line renderer, not the terminal.
Reproduction
Configure a statusLine.command that emits two rows where the second row starts with spaces (e.g. an empty leading column padded for alignment):
printf 'AAA │ next $0.10 │ ctx 20%%\n │ last $0.20 │ sess $5\n'
(│ = │.) The intent is for the two │ dividers to line up vertically:
AAA │ next $0.10 │ ctx 20%
│ last $0.20 │ sess $5
Expected
Leading whitespace preserved, so the second row's │ stays under the first row's │ (as it does when the exact same bytes are printf'd directly at a shell prompt).
Actual
The second row's leading spaces are removed, so it renders as:
AAA │ next $0.10 │ ctx 20%
│ last $0.20 │ sess $5
— the whole row shifts left and every column misaligns. Only the leading whitespace is affected; whitespace mid-row (between populated cells) is preserved.
Impact
Any left-anchored multi-column / grid layout in a multi-line status line breaks whenever a row's first column is empty (rendered as padding spaces). The only workaround is to ensure every row begins with a non-whitespace character.
Notes
- Confirmed by printing the identical bytes both via the status line (misaligned) and directly at an iTerm2 prompt (aligned) — isolating the transform to Claude Code.
- I couldn't find this documented in the status line docs (multi-line, ANSI, width/truncation are covered; leading-whitespace handling is not).
Environment
- Claude Code v2.1.183
- macOS (Darwin 24.6.0)
- iTerm2
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗