From f3e3061a7ff0307c9ad0efc06b58b3ce8a9553cd Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 8 Jun 2023 11:21:35 +0200 Subject: Fix a bug in footnote together-keeping logic --- library/src/layout/flow.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'library/src') 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; } -- cgit v1.2.3