Ignore empty word break ranges, clarify ranges must fall on character boundaries - #720
Merged
Merged
Conversation
This was referenced Jul 30, 2026
nicoburns
reviewed
Jul 30, 2026
nicoburns
left a comment
Collaborator
There was a problem hiding this comment.
Would it be better to store this as a flat Vec of indices (usize rather than Range<usize>)?
Member
Author
I think probably not, because of gaps using |
nicoburns
approved these changes
Jul 31, 2026
tomcur
added a commit
to tomcur/parley
that referenced
this pull request
Jul 31, 2026
On top of linebender#720, as otherwise that code hits an underflow. Empty text still needs a style, e.g., to be able to size cursors. This PR plumbs the root style through. I hit this when making font selection infallible, which tripped up the `builders_empty` test. (This might also be useful for sizing "struts".) Because with this change these empty layouts now actually have a style, that means font selection now succeeds in the `builders_empty` test, where it previously failed. Not having a font was the only reason there weren't any runs in the changed test, because, for empty text, `parley` actually shapes a space character, which should lead to a run. I've chosen to remove checking that runs are empty from the test, as I think it's mostly checking the wrong thing at the moment. If we ever stop synthesizing a space character for empty text, we should revisit this.
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.
Empty ranges must be ignored, as otherwise the range the iterator is pointing can get out of sync with the character.