Conversation
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.
|
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
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.
Problem
LeadingSpace::FirstRowgives the space to the first row of a section.line_breakdropped 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_breakstarts a new row at the first glyph of a section, it keeps theFirstRowspace 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
FirstRowspace. 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 usesIndent, so they do not change.Tests
test_wrapped_section_keeps_leading_spacefails without the change and passes with it.test_wrapped_section_keeps_leading_space_after_indentadds the space to theIndentof the paragraph.test_wrapped_section_drops_negative_leading_spacefails without the clamp.test_truncate_with_pixels_per_pointfails onmembranewithout this change too. It passes onjuan/faster-hotpatch.