@@ -296,7 +296,9 @@ private function display() : void
296
296
continue ;
297
297
}
298
298
299
- switch ($ char ->getControl ()) {
299
+ $ controlChar = $ char ->getControl ();
300
+
301
+ switch ($ controlChar ) {
300
302
case InputCharacter::UP :
301
303
case InputCharacter::DOWN :
302
304
$ this ->moveSelectionVertically ($ char ->getControl ());
@@ -310,6 +312,11 @@ private function display() : void
310
312
case InputCharacter::ENTER :
311
313
$ this ->executeCurrentItem ();
312
314
break ;
315
+ default :
316
+ if (isset ($ this ->customControlMappings [$ controlChar ])) {
317
+ $ this ->customControlMappings [$ controlChar ]($ this );
318
+ }
319
+ break ;
313
320
}
314
321
}
315
322
unset($ reader );
@@ -374,7 +381,7 @@ protected function moveSelectionHorizontally(string $direction) : void
374
381
: (int ) reset ($ itemKeys );
375
382
}
376
383
} while (!$ item ->canSelectIndex ($ selectedItemIndex ));
377
-
384
+
378
385
$ item ->setSelectedItemIndex ($ selectedItemIndex );
379
386
}
380
387
@@ -541,7 +548,7 @@ protected function draw() : void
541
548
protected function drawMenuItem (MenuItemInterface $ item , bool $ selected = false ) : array
542
549
{
543
550
$ rows = $ item ->getRows ($ this ->style , $ selected );
544
-
551
+
545
552
if ($ item instanceof SplitItem) {
546
553
$ selected = false ;
547
554
}
@@ -586,7 +593,7 @@ public function open() : void
586
593
if ($ this ->isOpen ()) {
587
594
return ;
588
595
}
589
-
596
+
590
597
if (count ($ this ->items ) === 0 ) {
591
598
throw new \RuntimeException ('Menu must have at least 1 item before it can be opened ' );
592
599
}
0 commit comments