mirror of
https://github.com/typst/typst
synced 2025-05-17 02:25:27 +08:00
fix orphan prevention
- Include new headers at the start as part of the region's header rows - Check if header rows are all rows
This commit is contained in:
parent
fe08df8ee6
commit
0c6fae92f0
@ -1447,7 +1447,7 @@ impl<'a> GridLayouter<'a> {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(Repeatable::as_repeated)
|
.and_then(Repeatable::as_repeated)
|
||||||
.is_none_or(|footer| footer.start != last_header_end)
|
.is_none_or(|footer| footer.start != last_header_end)
|
||||||
&& self.lrows.last().is_some_and(|row| row.index() < last_header_end)
|
&& self.lrows.len() == self.current_header_rows
|
||||||
&& !in_last_with_offset(
|
&& !in_last_with_offset(
|
||||||
self.regions,
|
self.regions,
|
||||||
// Since we're trying to find a region where to place all
|
// Since we're trying to find a region where to place all
|
||||||
|
@ -373,6 +373,7 @@ impl<'a> GridLayouter<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let HeadersToLayout::NewHeaders { headers, short_lived } = headers {
|
if let HeadersToLayout::NewHeaders { headers, short_lived } = headers {
|
||||||
|
let placing_at_the_start = skipped_region || self.lrows.is_empty();
|
||||||
for header in headers {
|
for header in headers {
|
||||||
let header_height =
|
let header_height =
|
||||||
self.layout_header_rows(header.unwrap(), engine, disambiguator)?;
|
self.layout_header_rows(header.unwrap(), engine, disambiguator)?;
|
||||||
@ -391,6 +392,11 @@ impl<'a> GridLayouter<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if placing_at_the_start {
|
||||||
|
// Track header rows at the start of the region.
|
||||||
|
self.current_header_rows = self.lrows.len();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user