diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 631adda35..dfe5ca2e9 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3928,7 +3928,7 @@ fn goto_indent_impl(cx: &mut Context, movement: Movement, direction: Direction) Direction::Backward => target_idx.saturating_add(1), }; - let indents: Vec = (line_idx..target_idx) + let indents: Vec = (line_idx.min(target_idx)..=line_idx.max(target_idx)) .map(|i| text.line(i)) .map(|l| l.chars().map_while(count_indent).sum()).collect();