diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs index ba2e92b91..2d86473e4 100644 --- a/helix-core/src/movement.rs +++ b/helix-core/src/movement.rs @@ -45,7 +45,7 @@ pub fn move_vertically( let new_line = match dir { Direction::Backward => row.saturating_sub(count), - Direction::Forward => std::cmp::min(row.saturating_add(count), text.len_lines() - 1), + Direction::Forward => std::cmp::min(row.saturating_add(count), text.len_lines() - 2), }; // convert to 0-indexed, subtract another 1 because len_chars() counts \n