Skip to content

fix(renderer): end auto-align merge groups at a hidden widget that isn't merged onward - #74

Merged
eric-engberg merged 13 commits into
feat/bar-widthfrom
fix/merge-hidden-align
Oct 27, 2026
Merged

eric-engberg merged 13 commits into
feat/bar-widthfrom
fix/merge-hidden-align

Conversation

@eric-engberg

Copy link
Copy Markdown
Owner

Builds on #14 (feat/bar-width) and merges #73 (fix/merge-across-hidden-widgets). Fork-only: it makes the two work together in next, like #52 does for #14 and #49.

What

#14 moved the auto-align column widths into getAlignmentColumns(), with its own hasRenderedWidgetBeforeSeparator() helper deciding whether a merge reaches the next rendered widget. #73 changes that rule everywhere it lived on main, but this helper only exists on #14's side, so merging the two kept the old rule here. This branch applies #73's rule to it: a merge carries past an empty widget only if that widget is merged onward too.

Why

Without it, auto-align would still treat A (merged) → hidden B → C as one merge group while the renderer draws A and C as separate segments, so the shared column widths wouldn't match the line.

How

Testing

A merged widget joined the next widget that rendered anything, skipping over
widgets that rendered nothing. So with Session Usage merged into a widget that
hides itself, the hidden widget took the merge with it to whatever followed:
the separator vanished and, in Powerline, every later segment shifted one
theme color. A merge now carries past an empty widget only when that widget is
merged onward too; otherwise it ends there and the usual boundary returns. The
Powerline, plain and auto-align paths all follow the same rule.
… into fix/merge-hidden-align

# Conflicts:
#	src/utils/renderer.ts
…rs too

The Powerline renderer now ends a merge at a widget that renders nothing
and isn't merged onward: A (merged), an empty unmerged widget, then B
draws a separator between A and B and gives B its own theme color. The
per-line counters that tell the next line where to pick up the separator
and theme-color cycles still followed the old rule and carried the merge
past every empty widget, so they counted one separator and one color
fewer than the line drew.

On a multi-line Powerline status line that put the next line one step
behind: its first separator repeated the previous glyph and, with
Continue Theme Across Lines on, its first segment reused the color of
the segment before it. Git Branch merged with Git Ahead/Behind hits this
whenever the branch is in sync. The TUI preview uses the same counters,
so it showed the same.

countSeparatorSlots and assignPowerlineThemeSlots now drop the pending
merge when they skip an empty widget that isn't merged onward, matching
the renderer. A merge still carries past empty widgets that are merged
onward themselves.
countSeparatorSlots had grown a branch per kind of widget inside its
loop. Each widget's effect on the count now lives in
advanceSeparatorSlots, which keeps the loop to one call and puts the
rules for separators, flex separators, hidden widgets and shown widgets
side by side. No change in behavior.
@sonarqubecloud

Copy link
Copy Markdown

@eric-engberg
eric-engberg merged commit 839cb38 into feat/bar-width Oct 27, 2026
5 checks passed
@eric-engberg

Copy link
Copy Markdown
Owner Author

Folded into #14: with #73 upstream as sirmalloc#698, #14 now meets #73's rule itself, so this fix moved there.

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.

1 participant