Stop matching new patterns past the end of QueryCursor's range
This restores the original signatures of the `set_byte_range` and `set_point_range` functions. Now, the QueryCursor will properly report matches that intersect, but are not fully contained by its range. Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
f597cc6a75
commit
fda35894d4
5 changed files with 122 additions and 152 deletions
|
|
@ -1810,9 +1810,9 @@ impl<'a, 'tree, T: TextProvider<'a>> Iterator for QueryMatches<'a, 'tree, T> {
|
|||
}
|
||||
|
||||
impl<'a, 'tree, T: TextProvider<'a>> QueryCaptures<'a, 'tree, T> {
|
||||
pub fn advance_to_byte(&mut self, offset: usize) {
|
||||
pub fn set_byte_range(&mut self, start: usize, end: usize) {
|
||||
unsafe {
|
||||
ffi::ts_query_cursor_advance_to_byte(self.ptr, offset as u32);
|
||||
ffi::ts_query_cursor_set_byte_range(self.ptr, start as u32, end as u32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue