Skip to content

fix(#198): a tab's label is cut with room to spare - #199

Merged
octalide merged 2 commits into
devfrom
fix/198
Oct 1, 2026
Merged

octalide merged 2 commits into
devfrom
fix/198

Conversation

@octalide

@octalide octalide commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Closes #198

Two causes, both pinned by tests that fail without their fix:

  • Separator (the visible one): a tab's body is drawn short of its separator (tab.margin.r), but the strip laid tabs out by body width alone, so every roomy tab's body was 1 px narrower than its label. A new room() (body plus separator, read once into the bar's Geom) is what the strip measures, scrolls and places by. natural, least and width stay body widths, so fix: unshrunk tabs cut their labels with an ellipsis #194's test still holds. Test: bar__a_tab_with_room_is_drawn_its_whole_width, which fails with the old layout.
  • Rounding far from the left edge: a box sized to its label is built from absolute coordinates, and around x of 1000 or more the rounding can leave it a hair short. fit_box now allows FIT_SLACK, a sixty-fourth of a pixel. Test: text__a_label_sized_to_its_box_is_whole_anywhere sweeps offsets from 900 to over 5000, and fails with the exact comparison.

Found by instrumenting octalide/ac's docked tab strips: each tab's natural width was 57.34 while its drawn rect was 56.34, with 18 px of empty tab after the ellipsis. With this branch the ac monitor's tabs read in full.

Ran mach test . (229 pass), mach fmt --check ., and the gallery and panel demo tests after mach dep pull. The goldens are unchanged.

…wn whole

a box sized to exactly its label, as a tab or a fit-width button builds it,
is formed from absolute coordinates, and far from the left edge their
rounding leaves it a hair narrower than the label, which fit_box then cut
with an ellipsis. the comparison is of float pixel widths, so it now allows
FIT_SLACK, a sixty-fourth of a pixel. the test draws labels in boxes sized
to them at offsets from 900 to over 5000 and fails without the fix.
a tab's body is drawn short of the separator after it (the tab style's
margin.r), but the strip measured and laid tabs out by their body width
alone, so every unshrunk tab's body came out one separator narrower than
its label and fit_box cut the label with an ellipsis. the strip now
measures, scrolls and places tabs by their room, the body and the separator,
read once into the bar's geometry. the test checks each roomy tab is drawn
its whole natural width, and fails with the old layout.
@octalide
octalide merged commit 952e87f into dev Oct 1, 2026
2 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.

fix: a tab's label is cut with room to spare

1 participant