Skip to content

fix(powerline): keep manual separators when toggling Powerline on and off - #713

Merged
sirmalloc merged 1 commit into
sirmalloc:mainfrom
vishnujayvel:oss/occ-kv7-preserve-separators
Oct 29, 2026
Merged

sirmalloc merged 1 commit into
sirmalloc:mainfrom
vishnujayvel:oss/occ-kv7-preserve-separators

Conversation

@vishnujayvel

Copy link
Copy Markdown
Contributor

What

Enabling Powerline mode with manual separator widgets in a line permanently
deleted those widgets (buildEnabledPowerlineSettings(settings, true)
filtered every type === 'separator' item out of settings.lines).
Disabling Powerline only flips powerline.enabled back to false — it never
restores anything, because by then the separators are already gone. This
closes #531: a manual separator now survives an enable → disable round trip.

Why

renderer.ts already keeps flex-separator widgets in the configuration
through Powerline rendering and treats them as merge-run boundaries
(isSeparatorBoundary), filtering them only out of the final rendered
glyphs. That's not the same as "inert": a flex-separator still drives
active layout underneath — it sizes flex slots, advances segment offsets,
and produces the start/end caps used by the flex-width distribution pass.
A separator widget, once it stops being deleted, gets the same
config-preservation and merge-boundary treatment flex-separator already
has, and likewise disappears from the rendered glyphs — but it doesn't pick
up that flex-layout role; it's only ever a boundary, never a spacing
control.

Being a merge-run boundary is also not a no-op. If a retained separator
sits between two widgets that would otherwise merge (e.g. one of them has
merge: 'no-padding'), hasNextRenderedWidgetBeforeSeparator now stops that
merge once Powerline is enabled, so the padding that merge was suppressing
comes back, and the two widgets no longer share a position in the
merge-aware theme color sequence (the color index only advances between
widgets that aren't merged with each other). So enabling Powerline on a line
with a retained separator inside a merged, themed group can change that
group's grouping, padding and color assignment — an expected consequence of
keeping the separator instead of deleting it, not a defect, but a real
rendering effect rather than a no-op.

How

  • buildEnabledPowerlineSettings no longer takes a removeManualSeparators
    flag and never filters settings.lines. The parameter had no remaining
    use once nothing is filtered.
  • Both call sites in PowerlineSetup.tsx (the no-existing-separators path
    and the confirm-dialog path) call the function with just settings.
  • The enable confirmation dialog (shown when a line already has manual
    separators) warned that enabling would remove them. That's no longer true,
    so the copy now says what actually happens: separators stay in the
    configuration but aren't shown while Powerline is enabled.

Tests

  • src/utils/__tests__/powerline-settings.test.ts: the test that encoded
    the destructive behavior as a requirement now asserts the separator is
    kept alongside a flex separator when enabling. Added a round-trip test
    that enables then disables and asserts the separator is still in
    settings.lines.
  • src/tui/components/__tests__/PowerlineSetup.test.ts: existing suite,
    unchanged, still passes — it doesn't exercise the t-toggle/confirm-dialog
    callback (checked by inspection), so no new UI-level test was added for the
    reworded warning text; the coverage above is at the settings-helper level
    where the actual logic change lives.
  • bun test src/utils/__tests__/powerline-settings.test.ts: 4 pass, 0 fail.
  • bun test src/tui/components/__tests__/PowerlineSetup.test.ts: 8 pass, 0 fail.
  • bun run lint (tsc --noEmit && eslint . --max-warnings=0): clean.
  • Full suite was not run for this change.

… off

Enabling Powerline mode called buildEnabledPowerlineSettings(settings, true),
which filtered every separator item out of every line. Disabling only flipped
powerline.enabled back to false and never restored anything, because the
separators were already gone from settings.lines by then. A user who tried
Powerline and backed out permanently lost that part of their configuration.

renderer.ts already treats flex-separator widgets as inert-but-present during
Powerline rendering: filtered from output, still used as merge-run boundaries
(isSeparatorBoundary). Extend that existing, shipped treatment to separator
widgets instead of deleting them, so manual separators survive an enable/
disable round trip exactly as flex separators already do. This is not a new
renderer behavior, just applying the renderer's existing symmetry to a
sibling widget type.

- buildEnabledPowerlineSettings no longer takes removeManualSeparators; lines
  are never filtered, so the parameter had no remaining use.
- Update both PowerlineSetup.tsx call sites to the new signature.
- The enable confirmation dialog's warning said enabling would delete manual
  separators, which is no longer true. Reword it to describe what actually
  happens: separators stay in the configuration but aren't rendered while
  Powerline is enabled.

Fixes sirmalloc#531.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sirmalloc
sirmalloc merged commit 21f010e into sirmalloc:main Oct 29, 2026
3 checks passed
pcvelz added a commit to pcvelz/ccstatusline-usage that referenced this pull request Oct 29, 2026
Upstream: Extra Usage Limit widget (sirmalloc#756), live widget preview while picking (sirmalloc#755), Fast Mode widget (sirmalloc#754), transcript block fallback fixes (sirmalloc#752), editor keys on a global install (sirmalloc#751), git cache TTL (sirmalloc#750), npx cached copy skip (sirmalloc#749), Block Usage hide at 100% (sirmalloc#747), Block Reset Timer hide until 100% (sirmalloc#697), fish-style branch abbreviation (sirmalloc#614), jj detached HEAD (sirmalloc#705), hooks save warning (sirmalloc#703), dev reload (sirmalloc#700), merge ends at a hidden widget (sirmalloc#698), Block Forecast and Block Limit Timer widgets (sirmalloc#699), contributor guide (sirmalloc#706), POSIX path case fix (sirmalloc#707), whitespace-distinct conflict filenames (sirmalloc#709), Quick Start reorder (sirmalloc#715), bunx launch guidance (sirmalloc#714), jj diff summary counts (sirmalloc#711), powerline manual separators (sirmalloc#713), keychain credential by account (sirmalloc#532), Keychain probe timeout (sirmalloc#760), usage cache scoped per CLAUDE_CONFIG_DIR (sirmalloc#266), test isolation (sirmalloc#717, sirmalloc#753), dev-dependency bumps (sirmalloc#745)

Conflicts resolved per the standard-resolution table; fork deletions re-applied.

Hand edits outside conflicts:
- src/utils/global-command-resolution.ts: fork-rename (ccstatusline@ -> ccstatusline-usage@ in upstream's new bunx pattern)
- src/utils/__tests__/global-package-manager.test.ts: fork-rename (package dir ccstatusline-usage in upstream's new tests)
- src/utils/usage-fetch.ts: compat fix - cacheUsageData gained a fetchedAtMs arg (upstream sirmalloc#266); adapted the fork-only fetchFreshUsageData call site
- src/utils/__tests__/usage-fetch.test.ts: compat fixes - cache/lock now hashed per CLAUDE_CONFIG_DIR (usageFilePath helper) in four fork tests; upstream fableUsage renamed to fork's weeklyFableUsage; seedUsageCache takes TokenHome
- src/utils/__tests__/usage-prefetch.test.ts: compat fix - mockFetchUsageData renamed to upstream's mockFetchUsage in cleanly-merged tests
- README.md: took upstream's Quick Start move (sirmalloc#715) and dropped the fork's old copy; fork-rename of its ccstatusline@ specifiers; links to fork-deleted docs (docs/USAGE.md, docs/WINDOWS.md) replaced with the fork's inline text
- CONTRIBUTING.md: links to the fork-deleted docs/DEVELOPMENT.md pointed at the README Development section
- docs/test-retirements.md: ledger entries for the 12 upstream test renames (sirmalloc#697, sirmalloc#698, sirmalloc#700, sirmalloc#705, sirmalloc#713, sirmalloc#760)
eric-engberg added a commit to eric-engberg/ccstatusline that referenced this pull request Oct 30, 2026
Brings in upstream main through #129. Files where main met the #49 and
#52 code this branch holds take the resolutions those branches made.
Turning Powerline on no longer removes manual separators (main's sirmalloc#713),
so buildEnabledPowerlineSettings takes only the settings again: this
branch's padding tests call it that way, and the per-line separator
removal test goes, as it did on #49.

# Conflicts:
#	docs/USAGE.md
#	src/ccstatusline.ts
#	src/tui/App.tsx
#	src/tui/__tests__/App-dev-reload.test.ts
#	src/tui/__tests__/App.test.ts
#	src/tui/components/ItemsEditor.tsx
#	src/tui/components/__tests__/ItemsEditor.test.ts
#	src/utils/__tests__/powerline-settings.test.ts
#	src/utils/powerline-settings.ts
#	src/utils/renderer.ts
#	src/widgets/SessionUsage.ts
#	src/widgets/__tests__/ThinkingEffort.test.ts
#	src/widgets/shared/usage-display.ts
#	src/widgets/shared/usage-percent-widget.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enabling Powerline mode permanently deletes manual separators

2 participants