mirror of
https://github.com/typst/typst
synced 2025-07-16 00:52:54 +08:00
fix footer widow check and rowspans
This commit is contained in:
parent
9422ecc74a
commit
b26e004be9
@ -1587,9 +1587,10 @@ impl<'a> GridLayouter<'a> {
|
|||||||
// TODO(subfooters): explicitly check for short-lived footers.
|
// TODO(subfooters): explicitly check for short-lived footers.
|
||||||
// TODO(subfooters): widow prevention for non-repeated footers with a
|
// TODO(subfooters): widow prevention for non-repeated footers with a
|
||||||
// similar mechanism / when implementing multiple footers.
|
// similar mechanism / when implementing multiple footers.
|
||||||
|
// TODO(subfooters): could progress check must be replaced to consider
|
||||||
|
// the presence of non-repeating footer (then always true).
|
||||||
let may_place_footers = !self.repeating_footers.is_empty()
|
let may_place_footers = !self.repeating_footers.is_empty()
|
||||||
&& self.current.lrows.is_empty()
|
&& (!self.current.lrows.is_empty() || !self.current.could_progress_at_top);
|
||||||
&& self.current.could_progress_at_top;
|
|
||||||
|
|
||||||
if may_place_footers {
|
if may_place_footers {
|
||||||
// Don't layout the footer if it would be alone with the header
|
// Don't layout the footer if it would be alone with the header
|
||||||
@ -1704,7 +1705,7 @@ impl<'a> GridLayouter<'a> {
|
|||||||
// laid out at the first frame of the row).
|
// laid out at the first frame of the row).
|
||||||
// Any rowspans ending before this row are laid out even
|
// Any rowspans ending before this row are laid out even
|
||||||
// on this row's first frame.
|
// on this row's first frame.
|
||||||
if !may_place_footers
|
if (!may_place_footers
|
||||||
|| self.repeating_footers.iter().all(|footer| {
|
|| self.repeating_footers.iter().all(|footer| {
|
||||||
// If this is a footer row, then only lay out this rowspan
|
// If this is a footer row, then only lay out this rowspan
|
||||||
// if the rowspan is contained within the footer.
|
// if the rowspan is contained within the footer.
|
||||||
@ -1720,7 +1721,8 @@ impl<'a> GridLayouter<'a> {
|
|||||||
// (what about the gutter?).
|
// (what about the gutter?).
|
||||||
!footer.range().contains(&y)
|
!footer.range().contains(&y)
|
||||||
|| footer.range().contains(&rowspan.y)
|
|| footer.range().contains(&rowspan.y)
|
||||||
}) && (rowspan.y + rowspan.rowspan < y + 1
|
}))
|
||||||
|
&& (rowspan.y + rowspan.rowspan < y + 1
|
||||||
|| rowspan.y + rowspan.rowspan == y + 1 && is_last)
|
|| rowspan.y + rowspan.rowspan == y + 1 && is_last)
|
||||||
{
|
{
|
||||||
// Rowspan ends at this or an earlier row, so we take
|
// Rowspan ends at this or an earlier row, so we take
|
||||||
|
Loading…
x
Reference in New Issue
Block a user