mirror of
https://github.com/typst/typst
synced 2025-05-13 12:36:23 +08:00
Ensure me is always contained in all
This commit is contained in:
parent
ae68a15a46
commit
736289b064
@ -112,7 +112,15 @@ impl EntryNode {
|
|||||||
let index = ctx
|
let index = ctx
|
||||||
.pins
|
.pins
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|other| other.is_in(&self.group) && other.flow < pin.flow)
|
.enumerate()
|
||||||
|
.filter(|&(k, other)| {
|
||||||
|
other.is_in(&self.group)
|
||||||
|
&& if k < idx {
|
||||||
|
other.flow <= pin.flow
|
||||||
|
} else {
|
||||||
|
other.flow < pin.flow
|
||||||
|
}
|
||||||
|
})
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
// Prepare first argument.
|
// Prepare first argument.
|
||||||
@ -248,7 +256,7 @@ impl PinBoard {
|
|||||||
|
|
||||||
/// Encode a group into a user-facing array.
|
/// Encode a group into a user-facing array.
|
||||||
fn encode_group(&self, group: &Group) -> Array {
|
fn encode_group(&self, group: &Group) -> Array {
|
||||||
let mut all: Vec<_> = self.iter().filter(|other| other.is_in(group)).collect();
|
let mut all: Vec<_> = self.iter().filter(|pin| pin.is_in(group)).collect();
|
||||||
all.sort_by_key(|pin| pin.flow);
|
all.sort_by_key(|pin| pin.flow);
|
||||||
all.iter()
|
all.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
|
@ -41,3 +41,22 @@
|
|||||||
))}
|
))}
|
||||||
|
|
||||||
As shown in #cite("abc") and #cite("def") and #cite("abc") ...
|
As shown in #cite("abc") and #cite("def") and #cite("abc") ...
|
||||||
|
|
||||||
|
---
|
||||||
|
// Test that `all` contains `me`.
|
||||||
|
// Ref: false
|
||||||
|
#show it: heading as group("headings").entry(
|
||||||
|
(me, all) => {
|
||||||
|
let last
|
||||||
|
for prev in all {
|
||||||
|
last = prev
|
||||||
|
if prev.index == me.index {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(last == me)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
= A
|
||||||
|
== B
|
||||||
|
Loading…
x
Reference in New Issue
Block a user