mirror of
https://github.com/nushell/reedline.git
synced 2024-09-11 15:55:50 +03:00
Fix big_word_left_index (#609)
* Fix big_word_left_index * add one more test --------- Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
This commit is contained in:
parent
12c6b7d3c7
commit
e2543f0790
@ -493,6 +493,7 @@ mod test {
|
||||
#[case("abc def ghi", 11, "abc def ")]
|
||||
#[case("abc def-ghi", 11, "abc ")]
|
||||
#[case("abc def.ghi", 11, "abc ")]
|
||||
#[case("abc def gh ", 11, "abc def ")]
|
||||
fn test_cut_big_word_left(
|
||||
#[case] input: &str,
|
||||
#[case] position: usize,
|
||||
|
@ -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),
|
||||
}
|
||||
})
|
||||
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user