Skip to content

Conversation

tronical
Copy link
Member

When Text elements in a vertical layout change their text, their height would be marked as dirty and thus the entire layout is invalidated. For text elements that don't wrap, the height solely depends on the font metrics.

Note: The text element itself might still render above and below that. The dependency tracking here is covered by the bounding_rect() function and the individual text item's property dependency tracker in the partial renderer.

When Text elements in a vertical layout change their text, their height would be marked as dirty and thus the entire layout is invalidated. For text elements that don't wrap, the height solely depends on the font metrics.

Note: The text element itself might still *render* above and below that.
The dependency tracking here is covered by the bounding_rect() function
and the individual text item's property dependency tracker in the
partial renderer.
@tronical tronical requested a review from ogoffart September 16, 2025 14:35
Copy link
Member

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

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

I'm not sure that's right.
Even with wrap: no-wrap (the default) a text can span multiple lines if there is actual new-line in it.

Example

Maybe NoWrap is badly named. We could have a never-wrap variant that don't return on newlines.
although even then: an empty text shouldn't take space in the layout

@tronical
Copy link
Member Author

Fair point! I'll extend this optimisation to include the line count for forced line-breaks.

@tronical
Copy link
Member Author

Err, I mean, change the optimisation to only apply when there are no forced line breaks.

@tronical
Copy link
Member Author

Ah crap, that means introducing a dependency on the text again :-(

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.

2 participants