|
|
@ -461,11 +461,19 @@ pub fn extend_first_nonwhitespace(cx: &mut Context) {
|
|
|
|
pub fn replace(cx: &mut Context) {
|
|
|
|
pub fn replace(cx: &mut Context) {
|
|
|
|
// 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::Char(ch),
|
|
|
|
} = event
|
|
|
|
..
|
|
|
|
{
|
|
|
|
} => Some(ch),
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Enter,
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
} => Some('\n'),
|
|
|
|
|
|
|
|
_ => None,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(ch) = ch {
|
|
|
|
let (view, doc) = cx.current();
|
|
|
|
let (view, doc) = cx.current();
|
|
|
|
|
|
|
|
|
|
|
|
let transaction =
|
|
|
|
let transaction =
|
|
|
|