mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Fix a bug in footnote together-keeping logic
This commit is contained in:
parent
10ae0a2c2b
commit
f3e3061a7f
@ -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;
|
||||
}
|
||||
|
BIN
tests/ref/bugs/footnote-keep-multiple.png
Normal file
BIN
tests/ref/bugs/footnote-keep-multiple.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
10
tests/typ/bugs/footnote-keep-multiple.typ
Normal file
10
tests/typ/bugs/footnote-keep-multiple.typ
Normal file
@ -0,0 +1,10 @@
|
||||
// Test that the logic that keeps footnote entry together with
|
||||
// their markers also works for multiple footnotes in a single
|
||||
// line or frame (here, there are two lines, but they are one
|
||||
// unit due to orphan prevention).
|
||||
|
||||
---
|
||||
#set page(height: 100pt)
|
||||
#v(30pt)
|
||||
A #footnote[a] \
|
||||
B #footnote[b]
|
Loading…
x
Reference in New Issue
Block a user