mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 04:44:30 +00:00
Implement MultiBufferSnapshot::contains_str_at
This commit is contained in:
parent
08e9f3e1e3
commit
358a6ff66c
1 changed files with 8 additions and 2 deletions
|
@ -735,8 +735,14 @@ impl MultiBufferSnapshot {
|
||||||
where
|
where
|
||||||
T: ToOffset,
|
T: ToOffset,
|
||||||
{
|
{
|
||||||
let offset = position.to_offset(self);
|
let position = position.to_offset(self);
|
||||||
self.as_singleton().unwrap().contains_str_at(offset, needle)
|
position == self.clip_offset(position, Bias::Left)
|
||||||
|
&& self
|
||||||
|
.bytes_in_range(position..self.len())
|
||||||
|
.flatten()
|
||||||
|
.copied()
|
||||||
|
.take(needle.len())
|
||||||
|
.eq(needle.bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_singleton(&self) -> Option<&BufferSnapshot> {
|
fn as_singleton(&self) -> Option<&BufferSnapshot> {
|
||||||
|
|
Loading…
Reference in a new issue