diff --git a/crates/typst-layout/src/grid/layouter.rs b/crates/typst-layout/src/grid/layouter.rs index 5d37584ec..d068c134e 100644 --- a/crates/typst-layout/src/grid/layouter.rs +++ b/crates/typst-layout/src/grid/layouter.rs @@ -317,10 +317,11 @@ impl<'a> GridLayouter<'a> { } } - if let Some(next_footer) = self.upcoming_footers.first() { + if let [next_footer, other_footers @ ..] = self.upcoming_footers { // TODO(subfooters): effective range (consider gutter before // if it was removed) if next_footer.range().contains(&y) { + self.upcoming_footers = other_footers; self.place_new_footer(engine, next_footer)?; self.flush_orphans(); y = next_footer.end; diff --git a/crates/typst-layout/src/grid/repeated.rs b/crates/typst-layout/src/grid/repeated.rs index 512593a5b..4fdbd8e62 100644 --- a/crates/typst-layout/src/grid/repeated.rs +++ b/crates/typst-layout/src/grid/repeated.rs @@ -567,6 +567,9 @@ impl<'a> GridLayouter<'a> { 0, )?; + self.repeating_footers + .extend(next_repeating_footers.iter().filter_map(Repeatable::as_repeated)); + Ok(()) }