Skip to content

Fix calculate_content_widths when inline boxes immediately follow a hard/explicit newline - #746

Merged
nicoburns merged 5 commits into
linebender:mainfrom
DioxusLabs:devin/1786652166-inline-box-after-newline-content-width
Sep 3, 2026
Merged

Fix calculate_content_widths when inline boxes immediately follow a hard/explicit newline#746
nicoburns merged 5 commits into
linebender:mainfrom
DioxusLabs:devin/1786652166-inline-box-after-newline-content-width

Conversation

@nicoburns

@nicoburns nicoburns commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

LLM Contributions: Bug identified and code generated with Devin Ultra.

Fix calculate_content_widths when an inline boxes immediately follows a hard/explicit newline. They were previously incorrectly counted as being before the newline because the "Mandatory Break" is only set on the character following the line break. This change mirrors what the line-breaking is already doing into the content width calculation.

Changelog

Added

  • Fix calculate_content_widths when an inline boxes immediately follows a hard/explicit newline. They were previously incorrectly counted as being before the newline.

@DJMcNab DJMcNab left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I don't have enough context to review this. It does look a bit suspect - the whitespace_advance(prev_atom) looks like it might be happening twice?

Comment thread parley_tests/tests/issues.rs Outdated
@nicoburns
nicoburns requested a review from tomcur September 3, 2026 11:52

@tomcur tomcur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct to me! I think the remaining use of boundary above may not be quite right yet, but that's not a regression here.

I'm thinking a bit about this function due to your comment on #762, and may just open a quick follow-up to fix that boundary (to be sequenced before #762).

Comment thread parley/src/layout/data.rs Outdated
Comment thread parley/src/layout/data.rs Outdated
nicoburns and others added 4 commits September 3, 2026 14:15
Signed-off-by: Nico Burns <nico@nicoburns.com>
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
@nicoburns
nicoburns force-pushed the devin/1786652166-inline-box-after-newline-content-width branch from b2e94d9 to 9f725ed Compare September 3, 2026 13:20
Signed-off-by: Nico Burns <nico@nicoburns.com>
@nicoburns

Copy link
Copy Markdown
Collaborator Author

I'm thinking a bit about this function due to your comment on #762, and may just open a quick follow-up to fix that boundary (to be sequenced before #762).

Hard to know what ordering would make most sense without seeing the patches, but my instinct is your suggestion is sensible.

@nicoburns
nicoburns enabled auto-merge September 3, 2026 13:22
@nicoburns
nicoburns added this pull request to the merge queue Sep 3, 2026
Merged via the queue into linebender:main with commit 4bfdcd7 Sep 3, 2026
24 checks passed
tomcur added a commit to tomcur/parley that referenced this pull request Sep 5, 2026
<!-- Please ensure that you have reviewed our LLM ("AI") policy at
https://linebender.org/wiki/llm-policy/.

If you did not use any LLM tools, please replace `Unspecified` with
`None`. -->
LLM Contributions: review.

Quick follow-up to linebender#746, giving the same treatment to `min_width` as
linebender#746 did to the `max_width`. So, if there's an inline box immediately
following a newline, that box's width is now correctly assigned to the
new line's `min_width`.

(Separately, I'm thinking about a nicer form for this function in
general, plus perhaps a good way to test it to actually catch this stuff
in CI.)

<!--
If our users need to know about this change, please describe that in the
quote block below.
What you write here will be edited by us later - it doesn't need to be
perfect.
If this change doesn't need a changelog entry, please replace the next
line with `**Changelog: None**`.
-->
**Changelog**

> ### Fixed
>
> - **Note to the editor:** this PR's entry should be merged with
linebender#746's.
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.

3 participants