From 584dd551e270c2e8caa73deb8a509d2536d03c90 Mon Sep 17 00:00:00 2001 From: Bob Qi Date: Wed, 13 Jul 2022 15:37:26 +0800 Subject: [PATCH] respect count in treesitter movement --- helix-core/src/movement.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs index 2155f77a42a4..fa8cdf3ad1e0 100644 --- a/helix-core/src/movement.rs +++ b/helix-core/src/movement.rs @@ -396,9 +396,9 @@ pub fn goto_treesitter_object( dir: Direction, slice_tree: Node, lang_config: &LanguageConfiguration, - _count: usize, + count: usize, ) -> Range { - let get_range = move || -> Option { + let get_range = move |range: Range| -> Option { let byte_pos = slice.char_to_byte(range.cursor(slice)); let cap_name = |t: TextObject| format!("{}.{}", object_name, t); @@ -436,7 +436,7 @@ pub fn goto_treesitter_object( // head of range should be at beginning Some(Range::new(end_char, start_char)) }; - get_range().unwrap_or(range) + (0..count).fold(range, |range, _| get_range(range).unwrap_or(range)) } #[cfg(test)]