Fix Global::gt
and rename it to changed_since
A false negative return value of `gt` was preventing guests' multibuffers from syncing correctly. Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
4b22e49ce1
commit
e5faaeb2f2
4 changed files with 41 additions and 26 deletions
|
@ -178,7 +178,7 @@ impl Global {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn ge(&self, other: &Self) -> bool {
|
||||
pub fn observed_all(&self, other: &Self) -> bool {
|
||||
let mut lhs = self.0.iter();
|
||||
let mut rhs = other.0.iter();
|
||||
loop {
|
||||
|
@ -196,22 +196,16 @@ impl Global {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn gt(&self, other: &Self) -> bool {
|
||||
let mut lhs = self.0.iter();
|
||||
let mut rhs = other.0.iter();
|
||||
loop {
|
||||
if let Some(left) = lhs.next() {
|
||||
if let Some(right) = rhs.next() {
|
||||
if left <= right {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return rhs.next().is_none();
|
||||
pub fn changed_since(&self, other: &Self) -> bool {
|
||||
if self.0.len() > other.0.len() {
|
||||
return true;
|
||||
}
|
||||
for (left, right) in self.0.iter().zip(other.0.iter()) {
|
||||
if left > right {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
pub fn iter<'a>(&'a self) -> impl 'a + Iterator<Item = Local> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue