Skip to content

Commit

Permalink
fix: Need to reset set_byte_range in case cursor_ref is reused.
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Sep 13, 2021
1 parent 32977ed commit 066367c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,8 @@ impl Syntax {
let config_ref =
unsafe { mem::transmute::<_, &'static HighlightConfiguration>(self.config.as_ref()) };

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

let captures = cursor_ref
.captures(query_ref, tree_ref.root_node(), RopeProvider(source))
Expand Down

0 comments on commit 066367c

Please sign in to comment.