Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"require": {
"php" : ">=7.1",
"beberlei/assert": "^2.4 | ^3",
"php-school/terminal": "dev-master",
"php-school/terminal": "^0.2",
"ext-posix": "*"
},
"autoload" : {
Expand Down
2 changes: 1 addition & 1 deletion src/CliMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public function disableDefaultControlMappings() : void
public function setDefaultControlMappings(array $defaultControlMappings) : void
{
$this->defaultControlMappings = $defaultControlMappings;
}
}

/**
* Adds a custom control mapping
Expand Down
5 changes: 5 additions & 0 deletions src/Input/InputIO.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public function collect(Input $input) : InputResult

$inputValue = $input->getPlaceholderText();
$havePlaceHolderValue = !empty($inputValue);

$originalValue = $inputValue;

$reader = new NonCanonicalReader($this->terminal);

Expand All @@ -59,6 +61,9 @@ public function collect(Input $input) : InputResult

if ($char->isHandledControl()) {
switch ($char->getControl()) {
case InputCharacter::ESC:
$this->parentMenu->redraw();
return new InputResult($originalValue);
case InputCharacter::ENTER:
if ($input->validate($inputValue)) {
$this->parentMenu->redraw();
Expand Down