File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed
Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 2121 "require" : {
2222 "php" : " >=7.1" ,
2323 "beberlei/assert" : " ^2.4 | ^3" ,
24- "php-school/terminal" : " dev-master " ,
24+ "php-school/terminal" : " ^0.2 " ,
2525 "ext-posix" : " *"
2626 },
2727 "autoload" : {
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ public function disableDefaultControlMappings() : void
214214 public function setDefaultControlMappings (array $ defaultControlMappings ) : void
215215 {
216216 $ this ->defaultControlMappings = $ defaultControlMappings ;
217- }
217+ }
218218
219219 /**
220220 * Adds a custom control mapping
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ public function collect(Input $input) : InputResult
4040
4141 $ inputValue = $ input ->getPlaceholderText ();
4242 $ havePlaceHolderValue = !empty ($ inputValue );
43+
44+ $ originalValue = $ inputValue ;
4345
4446 $ reader = new NonCanonicalReader ($ this ->terminal );
4547
@@ -59,6 +61,9 @@ public function collect(Input $input) : InputResult
5961
6062 if ($ char ->isHandledControl ()) {
6163 switch ($ char ->getControl ()) {
64+ case InputCharacter::ESC :
65+ $ this ->parentMenu ->redraw ();
66+ return new InputResult ($ originalValue );
6267 case InputCharacter::ENTER :
6368 if ($ input ->validate ($ inputValue )) {
6469 $ this ->parentMenu ->redraw ();
You can’t perform that action at this time.
0 commit comments