mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Fix fold order for vectors (#3496)
This commit is contained in:
parent
ca5d682edb
commit
85db05727b
@ -731,16 +731,16 @@ impl<T: Fold> Fold for Option<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Fold for Vec<T> {
|
impl<T> Fold for Vec<T> {
|
||||||
fn fold(mut self, outer: Self) -> Self {
|
fn fold(self, mut outer: Self) -> Self {
|
||||||
self.extend(outer);
|
outer.extend(self);
|
||||||
self
|
outer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, const N: usize> Fold for SmallVec<[T; N]> {
|
impl<T, const N: usize> Fold for SmallVec<[T; N]> {
|
||||||
fn fold(mut self, outer: Self) -> Self {
|
fn fold(self, mut outer: Self) -> Self {
|
||||||
self.extend(outer);
|
outer.extend(self);
|
||||||
self
|
outer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,6 @@ impl LayoutMultiple for Packed<EnumElem> {
|
|||||||
let mut cells = vec![];
|
let mut cells = vec![];
|
||||||
let mut number = self.start(styles);
|
let mut number = self.start(styles);
|
||||||
let mut parents = EnumElem::parents_in(styles);
|
let mut parents = EnumElem::parents_in(styles);
|
||||||
parents.reverse();
|
|
||||||
|
|
||||||
let full = self.full(styles);
|
let full = self.full(styles);
|
||||||
|
|
||||||
|
BIN
tests/ref/bugs/fold-vector.png
Normal file
BIN
tests/ref/bugs/fold-vector.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
20
tests/typ/bugs/fold-vector.typ
Normal file
20
tests/typ/bugs/fold-vector.typ
Normal file
@ -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))
|
||||||
|
])
|
Loading…
x
Reference in New Issue
Block a user