Add inline badges to custom statuslines (#64010)

Add a `badge` element to the statusline UI tree and TypeScript contract.
It renders one string as a padded, single-line label with normalized
whitespace. The optional `color` accepts `secondary` (the default),
`info`, `success`, `warning`, or `danger`. The renderer uses the
active theme for the label and blends the fill with the surrounding
background when its color is known.

Badges wrap as a unit. When a line limit requires an ellipsis after
earlier content, a trailing badge that cannot fit is dropped. At the
viewport edge, the right padding can clip while the full label remains
visible.

## Testing

Add rendering tests for wrapping, clipping, theme colors, and linked
badges, along with checks for UI tree limits and the TypeScript contract.

GitOrigin-RevId: be9e9799d6832976d325ba5fda48f5793dbbc722
This commit is contained in:
Joe Savona
2026-11-25 22:51:53 +00:00
committed by copyberry
parent 8d8de8f693
commit 09b1cfd337
11 changed files with 493 additions and 23 deletions
@@ -30,6 +30,7 @@ fn statusline_typescript_contract_matches_the_bundled_reference() -> color_eyre:
"RowElement",
"ColElement",
"BoxElement",
"BadgeElement",
"SpacerElement",
"CodeElement",
"StatuslineItemId",
@@ -71,6 +72,7 @@ fn generate_reference(output: &Path) -> color_eyre::Result<String> {
"Row",
"Col",
"Box",
"Badge",
"Spacer",
"Code",
] {