fix(renderer): drop spacing separator stranded against a flex-separator - #567
Open
tough-griff wants to merge 1 commit into
Open
fix(renderer): drop spacing separator stranded against a flex-separator#567tough-griff wants to merge 1 commit into
tough-griff wants to merge 1 commit into
Conversation
When the widget between a spacing-only separator and a flex-separator renders nothing, the separator survived the backward-only collapse logic. In the no-width flex fallback (piped/no-TTY, the common case under Claude Code) this produced a visible double space before the fallback " | ". Add a pass after trailing-separator trimming that removes spacing-only separators sitting directly against a flex-separator in the assembled elements array. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wu2bixWqAAfsMR72ttgZQA (cherry picked from commit bc6b5c36a19e6b58fb0cf00292394215f9cc5ad4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #566.
Problem
A spacing-only separator (
character: " ") that sits between a widget which renders nothing and aflex-separatoris not collapsed. The separator-collapse logic inrenderStatusLineonly walks backward for preceding content, so the spacing separator finds the widget before it and is emitted; it never notices that the flex-separator immediately after it (once the empty widget in between is filtered out) will provide its own spacing.With a known terminal width the flex-separator expands to fill the line and the extra space vanishes into the gap. With no terminal width (piped / no TTY — how Claude Code normally calls the status line) each flex-separator falls back to rendering
" | ", and the leftover space shows up as a visible double space:Fix
After the existing trailing-separator trim, walk
elementsonce and drop any spacing-only separator (isSpacingSeparator) that is directly adjacent to aflex-separator. By that point empty widgets have already been filtered out ofelements, so "adjacent to a flex-separator" is exactly the stranded-separator case. Visible separators (|,:, …) are left untouched so they can still act as an explicit boundary.This also very slightly improves the width-known path: the stray space was previously counted in
totalContentLength, shrinking the distributed flex gap by one column.Tests
renderer-separator-collapse.test.tsexercising the zero-width flex fallback (terminalWidth: 0), which the existing collapse/flex tests never cover.bun testgreen,bun run lintclean.