aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-01-09 15:42:06 +0000
committerBlaž Hrastnik2022-01-23 07:04:12 +0000
commit2f4a9fea03ffc7a2fb71ded0281d388289eceba9 (patch)
treeff5bdd42fdff7b0c0f180db3de208b7de9d63569 /helix-core/src
parent24314bd844d1900252f108968b39dfa4c800ca92 (diff)
Set byte range on cursor again
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/syntax.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 7359416d..677392b1 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -560,6 +560,7 @@ impl Syntax {
let ts_parser = &mut ts_parser.borrow_mut();
let mut cursor = ts_parser.cursors.pop().unwrap_or_else(QueryCursor::new);
// TODO: might need to set cursor range
+ cursor.set_byte_range(0..usize::MAX);
let source_slice = source.slice(..);
@@ -729,6 +730,9 @@ impl Syntax {
highlighter.cursors.pop().unwrap_or_else(QueryCursor::new)
});
+ // TODO: if range doesn't overlap layer range, skip it
+ // we can calculate intersection and use it later for set_byte_range
+
// The `captures` iterator borrows the `Tree` and the `QueryCursor`, which
// prevents them from being moved. But both of these values are really just
// pointers, so it's actually ok to move them.
@@ -737,8 +741,7 @@ impl Syntax {
// if reusing cursors & no range this resets to whole range
// TODO: handle intersect (range & layer.range)
- // cursor_ref.set_byte_range(range.clone().unwrap_or(0..usize::MAX));
- cursor_ref.set_byte_range(0..usize::MAX);
+ cursor_ref.set_byte_range(range.clone().unwrap_or(0..usize::MAX));
let mut captures = cursor_ref
.captures(