aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/movement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src/movement.rs')
-rw-r--r--helix-core/src/movement.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs
index cf7ea854..a3cd9b96 100644
--- a/helix-core/src/movement.rs
+++ b/helix-core/src/movement.rs
@@ -5,7 +5,7 @@ use ropey::iter::Chars;
use crate::{
coords_at_pos,
graphemes::{nth_next_grapheme_boundary, nth_prev_grapheme_boundary},
- pos_at_coords, Position, Range, RopeSlice, get_line_ending
+ pos_at_coords, Position, Range, RopeSlice, get_line_ending, line_end
};
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
@@ -38,9 +38,7 @@ pub fn move_horizontally(
}
Direction::Forward => {
// Line end is pos at the start of next line - 1
- let end = slice.line_to_char(line + 1).saturating_sub(get_line_ending(&slice.line(line))
- .map(|le| le.len_chars())
- .unwrap_or(0));
+ let end = line_end(&slice, line);
nth_next_grapheme_boundary(slice, pos, count).min(end)
}
};