Skip to content

Commit 066367c

Browse files
committed
fix: Need to reset set_byte_range in case cursor_ref is reused.
1 parent 32977ed commit 066367c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

helix-core/src/syntax.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,8 @@ impl Syntax {
372372
let config_ref =
373373
unsafe { mem::transmute::<_, &'static HighlightConfiguration>(self.config.as_ref()) };
374374

375-
// TODO: if reusing cursors this might need resetting
376-
if let Some(range) = &range {
377-
cursor_ref.set_byte_range(range.clone());
378-
}
375+
// if reusing cursors & no range this resets to whole range
376+
cursor_ref.set_byte_range(range.clone().unwrap_or(0..usize::MAX));
379377

380378
let captures = cursor_ref
381379
.captures(query_ref, tree_ref.root_node(), RopeProvider(source))

0 commit comments

Comments
 (0)