Skip to content

✨ feat(widgets): honor maxWidth in Git Branch and Git Root Dir#488

Open
gaborbernat wants to merge 1 commit into
sirmalloc:mainfrom
gaborbernat:feat/git-widget-max-width
Open

✨ feat(widgets): honor maxWidth in Git Branch and Git Root Dir#488
gaborbernat wants to merge 1 commit into
sirmalloc:mainfrom
gaborbernat:feat/git-widget-max-width

Conversation

@gaborbernat

Copy link
Copy Markdown

On a single-line status bar a long branch or repository name pushes the model, context and usage widgets past the terminal edge, where ccstatusline truncates the whole line with .... ✂️ Today only the Custom Command widget can cap its own output, so the native git widgets have no way to yield space. The long-branch reports in #349 and #350, along with the narrow-terminal truncation in #61 and #312, all land on this same limitation.

The maxWidth field already lives on every widget in the schema, yet only Custom Command reads it. This change lets Git Branch and Git Root Dir honor it too: each truncates its own visible text to the configured width with an ellipsis, so the widgets after it stay on screen. ✨ A shared max-width helper carries the truncation, the (w)idth keybind, the editor and the max:N modifier, matching the Custom Command pattern so the behavior and TUI feel consistent. For hyperlinked widgets only the visible label is shortened, and the link target stays whole.

Nothing changes when maxWidth is unset. Truncation goes through truncateStyledText, so it stays ANSI- and OSC8-aware.

@gaborbernat gaborbernat force-pushed the feat/git-widget-max-width branch from c06b0f1 to 40b3455 Compare June 27, 2026 01:13
The maxWidth field already exists on every widget in the schema, but only
the Custom Command widget honored it. On a single-line status bar a long
branch or repo name pushes the model, context and other widgets off the
end, where they are truncated as `|...`.

Let Git Branch and Git Root Dir truncate their own visible text to a
configured maxWidth (ellipsis included), so the rest of the line survives.
For hyperlinked widgets only the visible label is truncated; the link
target stays intact. A shared max-width helper carries the truncation,
the `(w)idth` keybind, the editor and the `max:N` modifier display.
@gaborbernat gaborbernat force-pushed the feat/git-widget-max-width branch from 40b3455 to 53b9546 Compare June 27, 2026 03:03
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