on master help sign in
Fix crash if pressing enter when nothing selected in completion.
commit350081a3af9a4cd87f177289d54feb8861b1313e authorBlaž Hrastnik <blaz@mxxn.io> dateWed 24 Mar 2021, 18:15 (6 years ago) parent8657c57
1 file changed+3−1
helix-term/src/ui/menu.rs+3−1
helix-term/src/ui/menu.rs+3−1
@@ -140,7 +140,9 @@ impl<T> Component for Menu<T> {
140140 code: KeyCode::Enter,
141141 ..
142142 } => {
143− (self.callback_fn)(cx.editor, self.selection(), MenuEvent::Validate);
143+ if let Some(selection) = self.selection() {
144+ (self.callback_fn)(cx.editor, Some(selection), MenuEvent::Validate);
145+ }
144146 return close_fn;
145147 }
146148 // KeyEvent {