Commit 038aaa1 1 parent e04c3a0 commit 038aaa1 Copy full SHA for 038aaa1
File tree 1 file changed +5
-9
lines changed
1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -205,16 +205,16 @@ impl<T: Item + 'static> Component for Menu<T> {
205
205
_ => return EventResult :: Ignored ( None ) ,
206
206
} ;
207
207
208
- let close_fn = EventResult :: Consumed ( Some ( Box :: new ( |compositor : & mut Compositor , _| {
208
+ let close_fn = Some ( Box :: new ( |compositor : & mut Compositor , _| {
209
209
// remove the layer
210
210
compositor. pop ( ) ;
211
- } ) ) ) ;
211
+ } ) ) ;
212
212
213
213
match event. into ( ) {
214
214
// esc or ctrl-c aborts the completion and closes the menu
215
215
key ! ( Esc ) | ctrl ! ( 'c' ) => {
216
216
( self . callback_fn ) ( cx. editor , self . selection ( ) , MenuEvent :: Abort ) ;
217
- return close_fn;
217
+ return EventResult :: Consumed ( close_fn) ;
218
218
}
219
219
// arrow up/ctrl-p/shift-tab prev completion choice (including updating the doc)
220
220
shift ! ( Tab ) | key ! ( Up ) | ctrl ! ( 'p' ) | ctrl ! ( 'k' ) => {
@@ -231,13 +231,9 @@ impl<T: Item + 'static> Component for Menu<T> {
231
231
key ! ( Enter ) => {
232
232
if let Some ( selection) = self . selection ( ) {
233
233
( self . callback_fn ) ( cx. editor , Some ( selection) , MenuEvent :: Validate ) ;
234
- return close_fn;
234
+ return EventResult :: Consumed ( close_fn) ;
235
235
} else {
236
- return EventResult :: Ignored ( Some ( Box :: new (
237
- |compositor : & mut Compositor , _| {
238
- compositor. pop ( ) ;
239
- } ,
240
- ) ) ) ;
236
+ return EventResult :: Ignored ( close_fn) ;
241
237
}
242
238
}
243
239
// KeyEvent {
You can’t perform that action at this time.
0 commit comments