mirror of
https://github.com/typst/typst
synced 2025-07-16 00:52:54 +08:00
fix footer layout order and consecutive footer pushing
This commit is contained in:
parent
8c416b88f2
commit
858e620ef7
@ -1600,12 +1600,20 @@ impl<'a> GridLayouter<'a> {
|
|||||||
//
|
//
|
||||||
// Use index for iteration to avoid borrow conflict.
|
// Use index for iteration to avoid borrow conflict.
|
||||||
//
|
//
|
||||||
|
// Note that repeating footers are in reverse order.
|
||||||
|
//
|
||||||
// TODO(subfooters): "pending footers" vector for footers we're
|
// TODO(subfooters): "pending footers" vector for footers we're
|
||||||
// about to place. Needed for widow prevention of non-repeated
|
// about to place. Needed for widow prevention of non-repeated
|
||||||
// footers.
|
// footers.
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while let Some(footer) = self.repeating_footers.get(i) {
|
while let Some(footer_index) = self.repeating_footers.len().checked_sub(1 + i)
|
||||||
self.layout_footer(footer, false, engine, self.finished.len())?;
|
{
|
||||||
|
self.layout_footer(
|
||||||
|
self.repeating_footers[footer_index],
|
||||||
|
false,
|
||||||
|
engine,
|
||||||
|
self.finished.len(),
|
||||||
|
)?;
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -550,9 +550,17 @@ impl<'a> GridLayouter<'a> {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Collect upcoming consecutive footers, they will start repeating with
|
||||||
|
// this one if compatible
|
||||||
|
let mut min_level = next_footer.level;
|
||||||
let first_conflicting_index = other_footers
|
let first_conflicting_index = other_footers
|
||||||
.iter()
|
.iter()
|
||||||
.take_while(|f| f.level > next_footer.level)
|
.take_while(|f| {
|
||||||
|
// TODO(subfooters): check for short-lived
|
||||||
|
let compatible = f.repeated && f.level > min_level;
|
||||||
|
min_level = f.level;
|
||||||
|
compatible
|
||||||
|
})
|
||||||
.count()
|
.count()
|
||||||
+ 1;
|
+ 1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user