aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-09-09 05:32:37 +0000
committerBlaž Hrastnik2021-09-13 08:44:57 +0000
commit066367c0a4fcfc1e7c2e926171672afef26736b4 (patch)
tree2557e0ef65e09fe82bcc41412ebb9ab5761a3f3d
parent32977ed34124a99af7b51057a6723203ce23c59c (diff)
fix: Need to reset set_byte_range in case cursor_ref is reused.
-rw-r--r--helix-core/src/syntax.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 1afe0e25..93da869b 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -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))