aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-02 04:12:11 +0000
committerBlaž Hrastnik2021-06-02 04:19:40 +0000
commit3ace581191e9c23aae23d7aabacd29c6b8ed7f65 (patch)
treee45dac811926a49f17b511aa3fe44921616df909
parentc0264b9f7f87b9357fb3dac948b39aae15f1ae30 (diff)
Fix panics when triggering w or e on the last char of the line
Closes #32
-rw-r--r--helix-core/src/movement.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs
index 2d86473e..f7c7786a 100644
--- a/helix-core/src/movement.rs
+++ b/helix-core/src/movement.rs
@@ -64,7 +64,7 @@ pub fn move_next_word_start(slice: RopeSlice, mut begin: usize, count: usize) ->
let mut end = begin;
for _ in 0..count {
- if begin + 1 == slice.len_chars() {
+ if begin + 2 > slice.len_chars() {
return None;
}
@@ -134,7 +134,7 @@ pub fn move_next_word_end(slice: RopeSlice, mut begin: usize, count: usize) -> O
let mut end = begin;
for _ in 0..count {
- if begin + 1 == slice.len_chars() {
+ if begin + 2 > slice.len_chars() {
return None;
}