Skip to content

Commit

Permalink
respect count in treesitter movement (#3058)
Browse files Browse the repository at this point in the history
  • Loading branch information
QiBaobin authored Jul 14, 2022
1 parent 4418924 commit 8681fb6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions helix-core/src/movement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)]
Expand Down

0 comments on commit 8681fb6

Please sign in to comment.