mirror of
https://github.com/typst/typst
synced 2025-05-17 02:25:27 +08:00
Keep all footnotes for line together for movable item
This commit is contained in:
parent
56f7ede964
commit
f62f7624a6
@ -313,9 +313,9 @@ impl<'a> FlowLayouter<'a> {
|
|||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.root && !self.handle_footnotes(vt, &mut notes, false)? {
|
if self.root && !self.handle_footnotes(vt, &mut notes, false, false)? {
|
||||||
self.finish_region()?;
|
self.finish_region()?;
|
||||||
self.handle_footnotes(vt, &mut notes, true)?;
|
self.handle_footnotes(vt, &mut notes, false, true)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.root = is_root;
|
self.root = is_root;
|
||||||
@ -352,12 +352,12 @@ impl<'a> FlowLayouter<'a> {
|
|||||||
let mut notes = Vec::new();
|
let mut notes = Vec::new();
|
||||||
find_footnotes(&mut notes, frame);
|
find_footnotes(&mut notes, frame);
|
||||||
self.items.push(item);
|
self.items.push(item);
|
||||||
if !self.handle_footnotes(vt, &mut notes, false)? {
|
if !self.handle_footnotes(vt, &mut notes, true, false)? {
|
||||||
let item = self.items.pop();
|
let item = self.items.pop();
|
||||||
self.finish_region()?;
|
self.finish_region()?;
|
||||||
self.items.extend(item);
|
self.items.extend(item);
|
||||||
self.regions.size.y -= size.y;
|
self.regions.size.y -= size.y;
|
||||||
self.handle_footnotes(vt, &mut notes, true)?;
|
self.handle_footnotes(vt, &mut notes, true, true)?;
|
||||||
}
|
}
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@ -479,6 +479,7 @@ impl FlowLayouter<'_> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
vt: &mut Vt,
|
vt: &mut Vt,
|
||||||
notes: &mut Vec<FootnoteElem>,
|
notes: &mut Vec<FootnoteElem>,
|
||||||
|
movable: bool,
|
||||||
force: bool,
|
force: bool,
|
||||||
) -> SourceResult<bool> {
|
) -> SourceResult<bool> {
|
||||||
let items_len = self.items.len();
|
let items_len = self.items.len();
|
||||||
@ -499,7 +500,10 @@ impl FlowLayouter<'_> {
|
|||||||
|
|
||||||
// If the entries didn't fit, abort (to keep footnote and entry
|
// If the entries didn't fit, abort (to keep footnote and entry
|
||||||
// together).
|
// together).
|
||||||
if !force && k == 0 && frames.first().map_or(false, Frame::is_empty) {
|
if !force
|
||||||
|
&& (k == 0 || movable)
|
||||||
|
&& frames.first().map_or(false, Frame::is_empty)
|
||||||
|
{
|
||||||
// Remove existing footnotes attempts because we need to
|
// Remove existing footnotes attempts because we need to
|
||||||
// move the item to the next page.
|
// move the item to the next page.
|
||||||
notes.truncate(notes_len);
|
notes.truncate(notes_len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user