✨ feat(widgets): honor maxWidth in Git Branch and Git Root Dir#488
Open
gaborbernat wants to merge 1 commit into
Open
✨ feat(widgets): honor maxWidth in Git Branch and Git Root Dir#488gaborbernat wants to merge 1 commit into
gaborbernat wants to merge 1 commit into
Conversation
c06b0f1 to
40b3455
Compare
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.
40b3455 to
53b9546
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
maxWidthfield 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 sharedmax-widthhelper carries the truncation, the(w)idthkeybind, the editor and themax:Nmodifier, 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
maxWidthis unset. Truncation goes throughtruncateStyledText, so it stays ANSI- and OSC8-aware.