[WIP] editor: Implement next/prev reference (#41078)
Co-authored-by: Cole <cole@zed.dev> Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
co-authored by
Cole
Conrad Irwin
parent
b75736568b
commit
5e7927f628
@@ -1541,6 +1541,24 @@ impl MultiBuffer {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn buffer_anchor_to_anchor(
|
||||
&self,
|
||||
buffer: &Entity<Buffer>,
|
||||
anchor: text::Anchor,
|
||||
cx: &App,
|
||||
) -> Option<Anchor> {
|
||||
let snapshot = buffer.read(cx).snapshot();
|
||||
for (excerpt_id, range) in self.excerpts_for_buffer(snapshot.remote_id(), cx) {
|
||||
if range.context.start.cmp(&anchor, &snapshot).is_le()
|
||||
&& range.context.end.cmp(&anchor, &snapshot).is_ge()
|
||||
{
|
||||
return Some(Anchor::in_buffer(excerpt_id, snapshot.remote_id(), anchor));
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
pub fn remove_excerpts(
|
||||
&mut self,
|
||||
excerpt_ids: impl IntoIterator<Item = ExcerptId>,
|
||||
|
||||
Reference in New Issue
Block a user