Skip to content

Commit

Permalink
Fix big_word_left_index
Browse files Browse the repository at this point in the history
  • Loading branch information
nibon7 committed Jul 20, 2023
1 parent 4f31e20 commit c2aa339
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core_editor/line_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,13 @@ impl LineBuffer {
match (last_word_index, is_whitespace_str(word)) {
(None, true) => None,
(None, false) => Some(i),
(Some(_), true) => None,
(Some(v), true) => {
if is_whitespace_str(&self.lines[i..self.insertion_point]) {
Some(v)
} else {
None
}
}
(Some(v), false) => Some(v),
}
})
Expand Down Expand Up @@ -1467,6 +1473,7 @@ mod test {
#[case("abc def ghi", 10, 8)]
#[case("abc def-ghi", 10, 4)]
#[case("abc def.ghi", 10, 4)]
#[case("abc def i", 10, 4)]
fn test_big_word_left_index(
#[case] input: &str,
#[case] position: usize,
Expand Down

0 comments on commit c2aa339

Please sign in to comment.