aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-27 06:20:58 +0000
committerNathan Vegdahl2021-07-27 06:20:58 +0000
commitaead4e69a66ba004aa34e5a1a59e05239117250e (patch)
tree94edfd068f61a6e199d5dbf079de7ccb514bb981
parent84f8167fd1d54a5ebf924d6d4a43bd24cfe40dd2 (diff)
Minor cleanup of the vertical movement code.
-rw-r--r--helix-core/src/movement.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs
index 38e14594..74307636 100644
--- a/helix-core/src/movement.rs
+++ b/helix-core/src/movement.rs
@@ -57,17 +57,12 @@ pub fn move_vertically(
let horiz = range.horiz.unwrap_or(col as u32);
// Compute the new position.
- let (new_pos, new_row) = {
- let new_row = match dir {
- Direction::Forward => (row + count).min(slice.len_lines().saturating_sub(1)),
- Direction::Backward => row.saturating_sub(count),
- };
- let new_col = col.max(horiz as usize);
- (
- pos_at_coords(slice, Position::new(new_row, new_col), true),
- new_row,
- )
+ let new_row = match dir {
+ Direction::Forward => (row + count).min(slice.len_lines().saturating_sub(1)),
+ Direction::Backward => row.saturating_sub(count),
};
+ let new_col = col.max(horiz as usize);
+ let new_pos = pos_at_coords(slice, Position::new(new_row, new_col), true);
// Special-case to avoid moving to the end of the last non-empty line.
if behaviour == Movement::Extend && slice.line(new_row).len_chars() == 0 {