This commit is contained in:
sxyazi 2023-11-20 16:16:07 +08:00
parent 2e89aa3e4b
commit 9de3fab65a
No known key found for this signature in database

View file

@ -14,14 +14,13 @@ impl From<&Exec> for Opt {
impl Input { impl Input {
pub fn forward(&mut self, opt: impl Into<Opt>) -> bool { pub fn forward(&mut self, opt: impl Into<Opt>) -> bool {
let opt = opt.into() as Opt; let opt = opt.into() as Opt;
let snap = self.snap(); let snap = self.snap();
if snap.value.is_empty() {
return self.move_(0);
}
let mut it = snap.value.chars().skip(snap.cursor).enumerate(); let mut it = snap.value.chars().skip(snap.cursor).enumerate();
let mut prev = CharKind::new(it.next().unwrap().1); let Some(mut prev) = it.next().map(|(_, c)| CharKind::new(c)) else {
return self.move_(0);
};
for (i, c) in it { for (i, c) in it {
let c = CharKind::new(c); let c = CharKind::new(c);
let b = if opt.end_of_word { let b = if opt.end_of_word {