diff --git a/crates/typst/src/foundations/styles.rs b/crates/typst/src/foundations/styles.rs index 30213cfc7..7a36c4caf 100644 --- a/crates/typst/src/foundations/styles.rs +++ b/crates/typst/src/foundations/styles.rs @@ -731,16 +731,16 @@ impl Fold for Option { } impl Fold for Vec { - fn fold(mut self, outer: Self) -> Self { - self.extend(outer); - self + fn fold(self, mut outer: Self) -> Self { + outer.extend(self); + outer } } impl Fold for SmallVec<[T; N]> { - fn fold(mut self, outer: Self) -> Self { - self.extend(outer); - self + fn fold(self, mut outer: Self) -> Self { + outer.extend(self); + outer } } diff --git a/crates/typst/src/model/enum.rs b/crates/typst/src/model/enum.rs index 6677913bd..4233cf0e3 100644 --- a/crates/typst/src/model/enum.rs +++ b/crates/typst/src/model/enum.rs @@ -230,7 +230,6 @@ impl LayoutMultiple for Packed { let mut cells = vec![]; let mut number = self.start(styles); let mut parents = EnumElem::parents_in(styles); - parents.reverse(); let full = self.full(styles); diff --git a/tests/ref/bugs/fold-vector.png b/tests/ref/bugs/fold-vector.png new file mode 100644 index 000000000..d8503a8eb Binary files /dev/null and b/tests/ref/bugs/fold-vector.png differ diff --git a/tests/typ/bugs/fold-vector.typ b/tests/typ/bugs/fold-vector.typ new file mode 100644 index 000000000..5d57ad333 --- /dev/null +++ b/tests/typ/bugs/fold-vector.typ @@ -0,0 +1,20 @@ +// Test fold order of vectors. + +--- +#set text(features: (liga: 1)) +#set text(features: (liga: 0)) +fi + +--- +#underline(stroke: aqua + 4pt)[ + #underline[Hello] +] + +--- +#let c = counter("mycounter") +#c.update(1) +#locate(loc => [ + #c.update(2) + #c.at(loc) \ + Second: #locate(loc => c.at(loc)) +])