|
|
@ -348,11 +348,18 @@ 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 {
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Enter,
|
|
|
|
|
|
|
|
..
|
|
|
|
|
|
|
|
} => '\n',
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
code: KeyCode::Char(ch),
|
|
|
|
code: KeyCode::Char(ch),
|
|
|
|
..
|
|
|
|
..
|
|
|
|
} = event
|
|
|
|
} => ch,
|
|
|
|
{
|
|
|
|
_ => return,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let (view, doc) = cx.current();
|
|
|
|
let (view, doc) = cx.current();
|
|
|
|
let text = doc.text().slice(..);
|
|
|
|
let text = doc.text().slice(..);
|
|
|
|
|
|
|
|
|
|
|
@ -369,7 +376,6 @@ where
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
doc.set_selection(view.id, selection);
|
|
|
|
doc.set_selection(view.id, selection);
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|