Implement TextBlock::recreateTextLine and basic multi line support#23215
Draft
evilpie wants to merge 2 commits intoruffle-rs:masterfrom
Draft
Implement TextBlock::recreateTextLine and basic multi line support#23215evilpie wants to merge 2 commits intoruffle-rs:masterfrom
evilpie wants to merge 2 commits intoruffle-rs:masterfrom
Conversation
| None => 0, | ||
| }; | ||
|
|
||
| if start >= full_text.len() { |
Collaborator
There was a problem hiding this comment.
Can start > full_text.len() ever be true?
Collaborator
Author
There was a problem hiding this comment.
So you mean we would usually assume that we either previously consumed less than or at most equal to the length of the full_text? That makes sense. But currently you can still pass random TextLines into that function, which means that property doesn't hold. I imagine when we add more checks we could maybe soften this to ==.
Collaborator
|
#15159 seems to hang with this PR |
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.
Improves #10173
This implements pretty basic multi-line support for FTE's TextBlock. Most of the code was written by Claude using the Weed to Wonder as a test case.
It works by first applying the current format and then measuring the number of characters that fit into the first line. The created TextLine is then limited to the number of chracters that fit. Based on the
textLineCreationResultbeing "success" (line created) or "completed" (all remaining text fit into the current line, no more lines needed) the caller (flashx) decides whether to create new lines or not.recreateTextLine allows re-layouting a specific line after changing its width. Which means it might fit more or less text than before.