Repository navigation
Conversation
theme.Style.overflow chooses whether a label too wide for its box is clipped at the box or cut with an ellipsis at its end, ellipsis by default. text.fit_box and text.fit_pair draw a label, or a label and a value, unchanged when they fit and fit to the box otherwise.
buttons and their groups, segmented choices, toggles, sliders, dropdowns and combos with their options, tabs and the tab overflow list, window and modal titles, section headings, table headers, list rows and progress text draw their labels through text.fit_box, so a label too wide for its box no longer spills over its neighbours.
the gallery's closable tab label was clipped mid-glyph at its close box, and is now cut with an ellipsis.
# Conflicts: # demo/gallery/src/bin/gallery.snap
octalide
marked this pull request as ready for review
October 1, 2026 16:39
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.
Closes #177
Plan
theme.Style.overflow(path<kind>.overflow, a factor): below 0.5 a label too wide for its box is clipped at the box, otherwise it is cut with an ellipsis at its end.theme.basedefaults it to 1 (ellipsis) for every kind. The README field table gets its row.text.fit_boxdraws a label exactly as before when it fits its box's span. When it does not, it ellipsizes it with the feat: text styles and rich spans #80 helpers (cut/cut_at, the n-byte forms offit/fit_at) or clips it, as the kind's overflow says. An ellipsis wider than the span falls back to clipping.text.fit_pairdoes the same for a label with a right-aligned value. The value keeps its width or half the room, whichever is less, and the label gets the rest.Decisions the issue left open
Golden snapshot
demo/gallery/src/bin/gallery.snapis regenerated (after merging dev, from dev's golden). The only change is the gallery's closable tab label. It was clipped mid-glyph at its close box and is now cut with an ellipsis.demo/panel's snapshot is unchanged.Ran
mach build . -p release,mach test . --filter blit.{widget,text,theme,tabs,list,table,controls,modal,style,editor}, the gallery and panel demo tests, andmach fmt --checkon the root and every demo. The new testlabel__narrow_button_and_segmented_keep_labels_in_their_boxcovers a too-narrow button and segmented choice in both the ellipsis and the clip mode.