aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helix-term/src/ui/menu.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs
index e9893588..049d6170 100644
--- a/helix-term/src/ui/menu.rs
+++ b/helix-term/src/ui/menu.rs
@@ -140,7 +140,9 @@ impl<T> Component for Menu<T> {
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;
}
// KeyEvent {