Fix whitespace collapsing removing spaces at style span boundaries - #17
Open
nicoburns wants to merge 1 commit into
Open
Fix whitespace collapsing removing spaces at style span boundaries#17nicoburns wants to merge 1 commit into
nicoburns wants to merge 1 commit into
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
LLM Contributions: This PR (code and description) was produced by Devin, requested and reviewed by @nicoburns.
TreeStyleBuilderinWhiteSpaceCollapse::Collapsemode was trimming whitespace at every style span boundary:push_style_spansetis_span_first = true, so the first text of every span had its leading whitespace stripped even when the preceding text ended in a non-space character.pop_style_spancommitted withis_span_last = true, stripping the span's trailing whitespace unconditionally.So
"Singer-songwriter"+<span>"\u{a0} · "</span>+"actress"collapsed toSinger-songwriter·actress— dropped separators and no soft-break opportunities. In Blitz this breaks Wikipedia infoboxes (hlists rendered asdisplay: inline<li>s with::afterseparators): the unbreakable text inflates the intrinsic width, overflowing the cell and misplacing the table columns (see https://en.wikipedia.org/wiki/Dolly_Parton, theabout=#mwt9infobox).Fix: leading trim now only happens at the start of the whole text or after existing trailing whitespace (
is_span_firstis no longer reset per-span), and trailing trim only happens at the end of the whole layout (pop_style_spancommits withis_span_last = false;finishstill trims the end).Known limitation: if the layout's final text ends inside a span with trailing collapsible whitespace, that single trailing space is now kept (previously the per-span trim removed it).
Blitz rendering of the Dolly Parton infobox with this fix (previously the text overflowed the infobox and the columns were misplaced):
Changelog
Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/dabfa60a5ab3411bb6c6225f9f81a79e
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/dabfa60a5ab3411bb6c6225f9f81a79e?variant=devin-insiders