summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorfrozolotl <44589151+frozolotl@users.noreply.github.com>2024-03-11 11:35:39 +0100
committerGitHub <noreply@github.com>2024-03-11 10:35:39 +0000
commit6e0b3484dd0360eef5365ce23144bfc59ade89ba (patch)
tree7ce11742aa4a0d584d18ed95ada5ad7f1ab98adc /crates
parent443cf60ae21d7d638a3279b64e22f6beb3a5f1b0 (diff)
Fix paragraph layouting index out of bounds bug (#3607)
Diffstat (limited to 'crates')
-rw-r--r--crates/typst/src/layout/flow.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/typst/src/layout/flow.rs b/crates/typst/src/layout/flow.rs
index bd693bd8..85f67142 100644
--- a/crates/typst/src/layout/flow.rs
+++ b/crates/typst/src/layout/flow.rs
@@ -244,17 +244,17 @@ impl<'a> FlowLayouter<'a> {
)?
.into_frames();
- let mut sticky = self.items.len();
- for (i, item) in self.items.iter().enumerate().rev() {
- match *item {
- FlowItem::Absolute(_, _) => {}
- FlowItem::Frame { sticky: true, .. } => sticky = i,
- _ => break,
- }
- }
-
if let Some(first) = lines.first() {
while !self.regions.size.y.fits(first.height()) && !self.regions.in_last() {
+ let mut sticky = self.items.len();
+ for (i, item) in self.items.iter().enumerate().rev() {
+ match *item {
+ FlowItem::Absolute(_, _) => {}
+ FlowItem::Frame { sticky: true, .. } => sticky = i,
+ _ => break,
+ }
+ }
+
let carry: Vec<_> = self.items.drain(sticky..).collect();
self.finish_region(engine, false)?;
for item in carry {