on master help sign in
fix: Need to reset set_byte_range in case cursor_ref is reused.
commit066367c0a4fcfc1e7c2e926171672afef26736b4 authorBlaž Hrastnik <blaz@mxxn.io> dateThu 9 Sep 2021, 14:32 (5 years ago) parent32977ed
1 file changed+2−4
helix-core/src/syntax.rs+2−4
helix-core/src/syntax.rs+2−4
@@ -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))