mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 03:59:55 +00:00
Fix Buffer::remote_selections_in_range
at query range boundaries
This commit is contained in:
parent
587a908225
commit
f8c2620166
1 changed files with 14 additions and 6 deletions
|
@ -1814,14 +1814,22 @@ impl BufferSnapshot {
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|(replica_id, _)| **replica_id != self.text.replica_id())
|
.filter(|(replica_id, _)| **replica_id != self.text.replica_id())
|
||||||
.map(move |(replica_id, selections)| {
|
.map(move |(replica_id, selections)| {
|
||||||
let start_ix = match selections
|
let start_ix = match selections.binary_search_by(|probe| {
|
||||||
.binary_search_by(|probe| probe.end.cmp(&range.start, self).unwrap())
|
probe
|
||||||
{
|
.end
|
||||||
|
.cmp(&range.start, self)
|
||||||
|
.unwrap()
|
||||||
|
.then(Ordering::Greater)
|
||||||
|
}) {
|
||||||
Ok(ix) | Err(ix) => ix,
|
Ok(ix) | Err(ix) => ix,
|
||||||
};
|
};
|
||||||
let end_ix = match selections
|
let end_ix = match selections.binary_search_by(|probe| {
|
||||||
.binary_search_by(|probe| probe.start.cmp(&range.end, self).unwrap())
|
probe
|
||||||
{
|
.start
|
||||||
|
.cmp(&range.end, self)
|
||||||
|
.unwrap()
|
||||||
|
.then(Ordering::Less)
|
||||||
|
}) {
|
||||||
Ok(ix) | Err(ix) => ix,
|
Ok(ix) | Err(ix) => ix,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue