set snapshot when laying out new headers

- Still need to detect when this doesn't make sense, e.g. in the last region, or right before a footer...
This commit is contained in:
PgBiel 2025-04-09 14:55:41 -03:00 committed by GitHub
parent 40bc08291d
commit e4bbe471a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -357,8 +357,9 @@ impl<'a> GridLayouter<'a> {
self.unbreakable_rows_left +=
total_header_row_count(headers.iter().map(Repeatable::unwrap));
let initial_row_count = self.lrows.len();
let placing_at_the_start =
skipped_region || self.lrows.len() == self.current_header_rows;
skipped_region || initial_row_count == self.current_header_rows;
for header in headers {
let header_height = self.layout_header_rows(header.unwrap(), engine, 0)?;
@ -382,6 +383,12 @@ impl<'a> GridLayouter<'a> {
self.current_header_rows = self.lrows.len();
}
// Remove new headers at the end of the region if upcoming child doesn't fit.
// TODO: Short lived if footer comes afterwards
if !short_lived {
self.lrows_orphan_snapshot = Some(initial_row_count);
}
Ok(())
}