fix: support unicode characters in kill command

This commit is contained in:
sxyazi 2024-01-15 16:47:44 +08:00
parent bf9f8f4273
commit ee8b8fc730
No known key found for this signature in database

View File

@ -62,8 +62,9 @@ impl Input {
input.take_while(|&c| CharKind::new(c) == first).count() + 1
}
let spaces = count_spaces(input.clone());
spaces + count_characters(input.skip(spaces))
let n = count_spaces(input.clone());
let n = n + count_characters(input.clone().skip(n));
input.take(n).fold(0, |acc, c| acc + c.len_utf8())
}
pub fn kill<'a>(&mut self, opt: impl Into<Opt<'a>>) {