-
-
Notifications
You must be signed in to change notification settings - Fork 833
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
Do not create a block frame for out-of-flow items only #2517
Conversation
Just removing the last frame seems like a strange thing to do. It probably happens to work because the next frame is too large to fit into the first region and the parent flow handles it, but generally a multi-region layouter should produce one frame per region. One thing that might work is to |
I agree that completely removing frames is weird. The problem is that, if I push
I'm not sure how to do that, because at at the start of |
What I meant is that rather than writing and then removing the frame with only out-of-flow elements, just don't create the frame at all, effectively deferring writing of the only out-of-flow elements. (Perhaps with the exception of the final finish_region call where we need to ensure that they are written.) |
Sorry for the delayed response. This is indeed smarter, although I now have this problem where there is an additional blank page in the last test. By removing the following lines, I can show the first frame even if it is empty (this part is unrelated to my PR, it is just a graphical thing). In the last test, the first frame is actually displaced in the second region, which is what causes the issue. typst/crates/typst-library/src/layout/container.rs Lines 431 to 433 in 987e97c
![]() I will try to rebase on |
Turns out setting the frame size to I will try to resolve the conflicts and solve the issue that frames with size zero are not necessarily out-of-flow, and then this will be ready to merge. In the meantime, I'm switching this PR to a draft. |
# Conflicts: # crates/typst/src/layout/flow.rs
I think this should now be safe to merge! |
Thank you, also for the patience! |
Fixes #2297
This PR makes it so that, when a breakable block is broken into multiple frames, a frame containing only out-of-flow items (which correspond to
place
elements, counter updates, etc.) will move its items to the next frame if there is one.Please review this carefully! I was not familiar with this part of the codebase when I started working on that, so please make sure I did not write anything stupid. All tests pass, so it should be ok, but there are still some things I'm not fully confident about (see comments). In particular, because this fix is implemented by modifying the way
FlowElem
is laid out, I think it may affect other things (although I could not think of any).