on master help sign in
Fix crash if pressing enter when nothing selected in completion.
350081aBlaž Hrastnik
helix-term/src/ui/menu.rs+3−1
@@ -140,7 +140,9 @@ impl<T> Component for Menu<T> {
140 code: KeyCode::Enter,
140 code: KeyCode::Enter,
141 ..
141 ..
142 } => {
142 } => {
143+ if let Some(selection) = self.selection() {
143− (self.callback_fn)(cx.editor, self.selection(), MenuEvent::Validate);
144+ (self.callback_fn)(cx.editor, Some(selection), MenuEvent::Validate);
145+ }
144 return close_fn;
146 return close_fn;
145 }
147 }
146 // KeyEvent {
148 // KeyEvent {