diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-06-08 11:21:35 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-06-08 11:21:35 +0200 |
| commit | f3e3061a7ff0307c9ad0efc06b58b3ce8a9553cd (patch) | |
| tree | e26cbcc4c51c546015e9b61b9211680f643d72bf /library/src/layout/flow.rs | |
| parent | 10ae0a2c2b54ee1dc1119de528fd209eea5284b4 (diff) | |
Fix a bug in footnote together-keeping logic
Diffstat (limited to 'library/src/layout/flow.rs')
| -rw-r--r-- | library/src/layout/flow.rs | 7 |
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; } |
