summaryrefslogtreecommitdiff
path: root/library/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-06-08 11:21:35 +0200
committerLaurenz <laurmaedje@gmail.com>2023-06-08 11:21:35 +0200
commitf3e3061a7ff0307c9ad0efc06b58b3ce8a9553cd (patch)
treee26cbcc4c51c546015e9b61b9211680f643d72bf /library/src
parent10ae0a2c2b54ee1dc1119de528fd209eea5284b4 (diff)
Fix a bug in footnote together-keeping logic
Diffstat (limited to 'library/src')
-rw-r--r--library/src/layout/flow.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/library/src/layout/flow.rs b/library/src/layout/flow.rs
index 627ea988..6940b55c 100644
--- a/library/src/layout/flow.rs
+++ b/library/src/layout/flow.rs
@@ -438,6 +438,7 @@ impl FlowLayouter<'_> {
find_footnotes(&mut notes, frame);
}
+ let prev_len = self.items.len();
self.items.push(item);
// No new footnotes.
@@ -473,10 +474,12 @@ impl FlowLayouter<'_> {
if !had_footnotes {
self.items.pop();
}
- let item = self.items.pop();
+ let moved: Vec<_> = self.items.drain(prev_len..).collect();
self.finish_region()?;
- self.items.extend(item);
+ self.has_footnotes =
+ moved.iter().any(|item| matches!(item, FlowItem::Footnote(_)));
self.regions.size.y -= height;
+ self.items.extend(moved);
can_skip = false;
continue 'outer;
}