Fix crash if pressing enter when nothing selected in completion.
This commit is contained in:
parent
8657c57cf2
commit
350081a3af
1 changed files with 3 additions and 1 deletions
|
@ -140,7 +140,9 @@ impl<T> Component for Menu<T> {
|
||||||
code: KeyCode::Enter,
|
code: KeyCode::Enter,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
(self.callback_fn)(cx.editor, self.selection(), MenuEvent::Validate);
|
if let Some(selection) = self.selection() {
|
||||||
|
(self.callback_fn)(cx.editor, Some(selection), MenuEvent::Validate);
|
||||||
|
}
|
||||||
return close_fn;
|
return close_fn;
|
||||||
}
|
}
|
||||||
// KeyEvent {
|
// KeyEvent {
|
||||||
|
|
Loading…
Add table
Reference in a new issue