aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorBob2022-07-14 00:08:09 +0000
committerGitHub2022-07-14 00:08:09 +0000
commit8681fb6d9ee06610fac2baafb4ca34f93f9c7f4d (patch)
treeada8b6adf05360a44ff93c41dd42a386269408bc /helix-core/src
parent4418924ec34c28e43ce34809edaac4ce4fd9f72c (diff)
respect count in treesitter movement (#3058)
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/movement.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs
index 2155f77a..fa8cdf3a 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<Range> {
+ let get_range = move |range: Range| -> Option<Range> {
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)]