diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-27 14:20:05 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-27 14:20:05 +0200 |
| commit | 736289b064c53c215249aad70b3a6a96e79b6021 (patch) | |
| tree | 6021129a25de18caa18469c946936f99bd7cb659 /src/model | |
| parent | ae68a15a46c3a9fce4db7bfbf129ee103dd4c30d (diff) | |
Ensure me is always contained in all
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/locate.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/model/locate.rs b/src/model/locate.rs index c73c0339..05204d2e 100644 --- a/src/model/locate.rs +++ b/src/model/locate.rs @@ -112,7 +112,15 @@ impl EntryNode { let index = ctx .pins .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(); // Prepare first argument. @@ -248,7 +256,7 @@ impl PinBoard { /// Encode a group into a user-facing 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.iter() .enumerate() |
