@@ -57,27 +57,29 @@ public function collect(Input $input) : InputResult
57
57
continue ;
58
58
}
59
59
60
- switch ($ char ->getControl ()) {
61
- case InputCharacter::ENTER :
62
- if ($ input ->validate ($ inputValue )) {
60
+ if ($ char ->isHandledControl ()) {
61
+ switch ($ char ->getControl ()) {
62
+ case InputCharacter::ENTER :
63
+ if ($ input ->validate ($ inputValue )) {
64
+ $ this ->parentMenu ->redraw ();
65
+ return new InputResult ($ inputValue );
66
+ } else {
67
+ $ this ->drawInputWithError ($ input , $ inputValue );
68
+ continue 2 ;
69
+ }
70
+
71
+ case InputCharacter::BACKSPACE :
72
+ $ inputValue = substr ($ inputValue , 0 , -1 );
63
73
$ this ->parentMenu ->redraw ();
64
- return new InputResult ($ inputValue );
65
- } else {
66
- $ this ->drawInputWithError ($ input , $ inputValue );
74
+ $ this ->drawInput ($ input , $ inputValue );
67
75
continue 2 ;
68
- }
69
-
70
- case InputCharacter::BACKSPACE :
71
- $ inputValue = substr ($ inputValue , 0 , -1 );
72
- $ this ->parentMenu ->redraw ();
73
- $ this ->drawInput ($ input , $ inputValue );
74
- continue 2 ;
75
- }
76
+ }
76
77
77
- if (!empty ($ this ->callbacks [$ char ->getControl ()])) {
78
- foreach ($ this ->callbacks [$ char ->getControl ()] as $ callback ) {
79
- $ inputValue = $ callback ($ inputValue );
80
- $ this ->drawInput ($ input , $ inputValue );
78
+ if (!empty ($ this ->callbacks [$ char ->getControl ()])) {
79
+ foreach ($ this ->callbacks [$ char ->getControl ()] as $ callback ) {
80
+ $ inputValue = $ callback ($ inputValue );
81
+ $ this ->drawInput ($ input , $ inputValue );
82
+ }
81
83
}
82
84
}
83
85
}
0 commit comments