Skip to content

✨ feat(renderer): let widgets opt out of powerline auto-align#489

Merged
sirmalloc merged 3 commits into
sirmalloc:mainfrom
gaborbernat:feat/exclude-from-auto-align
Jun 30, 2026
Merged

✨ feat(renderer): let widgets opt out of powerline auto-align#489
sirmalloc merged 3 commits into
sirmalloc:mainfrom
gaborbernat:feat/exclude-from-auto-align

Conversation

@gaborbernat

Copy link
Copy Markdown
Contributor

In powerline auto-align mode every widget is padded so its column lines up with the widget directly above and below it. ✨ That vertical alignment is the whole point of the mode, but it has a sharp edge: one wide widget, such as a long git branch or repository name, stretches its column on every other line too, so a short value on another line carries a trail of padding and the bar wastes horizontal space.

This adds an excludeFromAutoAlign flag on a widget. A flagged widget, and everything after it on the same line, stops contributing to the shared column widths and stops receiving alignment padding, so it keeps its natural width while the columns before it stay aligned. 📏 The two sides of the renderer move together: calculateMaxWidthsFromPreRendered skips the rest of the line once it reaches a flagged widget, and the powerline render path skips padding from the same point. The items editor exposes an e(x)clude align toggle and a (no-align) marker, both shown only when powerline auto-align is on, so the option appears where it has an effect.

This is the design suggested in #349 and #350, where per-line column widths were proposed to solve the same long-branch problem. Default behavior is unchanged: a widget aligns exactly as before until the flag is set.

gaborbernat and others added 3 commits June 26, 2026 18:54
In powerline auto-align mode every widget is padded so its column lines
up with the widget above and below it. A single wide widget, such as a
long git branch, therefore stretches that column on every other line and
wastes horizontal space.

Add an `excludeFromAutoAlign` flag. A flagged widget, and everything
after it on the same line, stops contributing to the shared column widths
and stops receiving alignment padding, so it keeps its natural width
while the columns before it stay aligned. The items editor exposes an
`e(x)clude align` toggle and a `(no-align)` marker, shown only when
powerline auto-align is on.
Only allow excludeFromAutoAlign to be toggled from the items editor when powerline auto-align is active and the selected widget is not merged into a previous widget. This keeps the shortcut behavior aligned with the visible help text and prevents hidden exclusions from being persisted while the feature is unavailable.

Treat no-align as a merge-chain-head option in the UI, so widgets merged into a previous item no longer show an effective no-align marker. The renderer keeps merged-in widgets participating in their parent group width while still honoring exclusions on the first widget in the chain.

Add regression coverage for merged no-align width calculation and for the editor shortcut gate.
@sirmalloc sirmalloc merged commit c20e111 into sirmalloc:main Jun 30, 2026
3 checks passed
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.

2 participants