commands: Handle `t<ENTER>` as till newline

imgbot
Wojciech Kępka 4 years ago committed by Blaž Hrastnik
parent a8a5bcd13d
commit 0c2b99327a

@ -348,28 +348,34 @@ where
// need to wait for next key // need to wait for next key
cx.on_next_key(move |cx, event| { cx.on_next_key(move |cx, event| {
if let KeyEvent { let ch = match event {
code: KeyCode::Char(ch), KeyEvent {
.. code: KeyCode::Enter,
} = event ..
{ } => '\n',
let (view, doc) = cx.current(); KeyEvent {
let text = doc.text().slice(..); code: KeyCode::Char(ch),
..
} => ch,
_ => return,
};
let selection = doc.selection(view.id).transform(|mut range| { let (view, doc) = cx.current();
search_fn(text, ch, range.head, count, inclusive).map_or(range, |pos| { let text = doc.text().slice(..);
if extend {
Range::new(range.anchor, pos)
} else {
// select
Range::new(range.head, pos)
}
// or (pos, pos) to move to found val
})
});
doc.set_selection(view.id, selection); let selection = doc.selection(view.id).transform(|mut range| {
} search_fn(text, ch, range.head, count, inclusive).map_or(range, |pos| {
if extend {
Range::new(range.anchor, pos)
} else {
// select
Range::new(range.head, pos)
}
// or (pos, pos) to move to found val
})
});
doc.set_selection(view.id, selection);
}) })
} }

Loading…
Cancel
Save