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:
Max Brunsfeld 2021-05-25 13:11:22 -07:00
parent f597cc6a75
commit fda35894d4
5 changed files with 122 additions and 152 deletions

View file

@ -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);
}
}
}