mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
restore orphan snapshot after pending header relayout
This commit is contained in:
parent
fc6a0074d8
commit
e0bfe90e12
@ -1542,12 +1542,6 @@ impl<'a> GridLayouter<'a> {
|
||||
|
||||
let mut laid_out_footer_start = None;
|
||||
if !footer_would_be_widow {
|
||||
// Did not trigger automatic header orphan / footer widow check.
|
||||
// This means pending headers have successfully been placed once
|
||||
// without hitting orphan prevention, so they may now be moved into
|
||||
// repeating headers.
|
||||
self.flush_pending_headers();
|
||||
|
||||
if let Some(Repeatable::Repeated(footer)) = &self.grid.footer {
|
||||
// Don't layout the footer if it would be alone with the header in
|
||||
// the page (hence the widow check), and don't layout it twice.
|
||||
|
@ -289,6 +289,12 @@ impl<'a> GridLayouter<'a> {
|
||||
|
||||
self.current_repeating_header_rows = self.lrows.len();
|
||||
|
||||
if !self.pending_headers.is_empty() {
|
||||
// Restore snapshot: if pending headers placed again turn out to be
|
||||
// orphans, remove their rows again.
|
||||
self.lrows_orphan_snapshot = Some(self.lrows.len());
|
||||
}
|
||||
|
||||
for header in self.pending_headers {
|
||||
let header_height =
|
||||
self.layout_header_rows(header.unwrap(), engine, disambiguator)?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user