Skip to content

Keep the leading space of a section that starts a wrapped row - #22

Open
iamseeley wants to merge 2 commits into
membranefrom
thomas/wrapped-leading-space
Open

iamseeley wants to merge 2 commits into
membranefrom
thomas/wrapped-leading-space

Conversation

@iamseeley

@iamseeley iamseeley commented Oct 1, 2026 •

Copy link
Copy Markdown

Problem

LeadingSpace::FirstRow gives the space to the first row of a section. line_break dropped the space when the first glyph of the section started a wrapped row. The row then started at x = 0.

A Brane chip keeps its icon and its padding in this space. A chip at the start of a wrapped row painted its background and icon past the left edge of the text.

Change

When line_break starts a new row at the first glyph of a section, it keeps the FirstRow space of that section. The wrap then measures the row with the space. A negative space stays out, because a row start has no text before it for the section to move back over.

Effect on other text

The change applies only to a wrapped row that starts a section with a nonzero FirstRow space. In gaze, this is the chips, the argument popup of the explorer (4 points), and the splice animation of the widget gallery. A gref view lays out one row, and a markdown list uses Indent, so they do not change.

Tests

  • test_wrapped_section_keeps_leading_space fails without the change and passes with it.
  • test_wrapped_section_keeps_leading_space_after_indent adds the space to the Indent of the paragraph.
  • test_wrapped_section_drops_negative_leading_space fails without the clamp.
  • test_truncate_with_pixels_per_point fails on membrane without this change too. It passes on juan/faster-hotpatch.

LeadingSpace::FirstRow gives the space to the first row of a section.
line_break dropped the space when the first glyph of the section
started a wrapped row. A Brane chip keeps its icon and padding in
this space, so the chip went past the left edge of the text.
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Preview is being built...

Preview will be available at https://egui-pr-preview.github.io/pr/22-thomas/wrapped-leading-space

View snapshot changes at kitdiff

A negative space moves a section back over the text before it. A
row start has no text before it, so the glyphs went past the left
edge. The text animator gives a negative space to the section after
a splice. Two tests cover an Indent row and a negative space.

This branch has not been deployed

No deployments
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