-
Notifications
You must be signed in to change notification settings - Fork 45
Fixes #138 - placing inline boxes #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0dfda2d
to
df1a6df
Compare
Do you have something that exercises this that I could try? I don't have anything to hand right now. |
There is an example code in #138 If you change index to 7 in inbox creation, you will see that the box that should be at the beginning of the second line is at the end of the first line without the fix. builder.push_inline_box(InlineBox {
id: 0,
index: 8, // <--------- HERE
width: 50.0,
height: 50.0,
}); |
This makes sense to me conceptually. It essentially replicates the code here https://github.com/linebender/parley/pull/163/files#diff-6d9ae7b3a7470dac93dc902558af7eaa8d82c912290e526296707eb14c77c2d1R263 but in the other branch. My head isn't in the code enough to be able to verify that the fix is correct. Probably (manually?) verifying this against a small number of test cases is a good way to go. I'd also be reasonably happy to take @spirali's word that this is a correct fix. We can always revert it if it causes problems. The whole See https://xi.zulipchat.com/#narrow/channel/205635-text/topic/Parley.20implementation.20details/near/440715310 on the motivation behind Nico:
Chad:
Nico:
Chad:
|
I did manual testing while I was trying to understand the problem. I also run this fix over tests of Nelsie (https://github.com/spirali/nelsie, branch "parley"). Nelsie heavily uses inline boxes and those tests actually discovered this problem. It covers only European languages, but it seems to me that it should be enough in this case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing behaviour is clearly wrong. Thia fix makes intuitive sense, and the usage is Nelsie is persuasive to me.
This is a draft because some functionality (mostly around word/line selection) is still missing. I also commented out the fix from #163 because the `skip_mandatory_break` flag is now gone and I haven't dug into the logic from that PR. Submitting this now so that people can take a look and see if it fixes some of the known bugs, particularly around newline handling. note: #166 should probably land first
When a inline box is placed at the beginning of the non-first line then line breaking is wrong.
Lets have the following text:
It produces the following items in layout:
[run, inlinebox, run]
But the line breaking occurs when the second run is processed. So inlinebox ends on the previous line.
This PR fixes it by checking that current cluster_idx is mandatory break and ends line before processing inline boxes