Skip to content

Commit

Permalink
Merge 824466c into f485c61
Browse files Browse the repository at this point in the history
  • Loading branch information
maximerenou committed Jan 4, 2019
2 parents f485c61 + 824466c commit 8e67973
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/TerminalObject/Dynamic/Radio.php
Expand Up @@ -15,4 +15,40 @@ protected function buildCheckboxes(array $options)
{
return new Checkbox\RadioGroup($options);
}

/**
* Take the appropriate action based on the input character,
* returns whether to stop listening or not
*
* @param string $char
*
* @return bool
*/
protected function handleCharacter($char)
{
switch ($char) {
case ' ':
case "\n":
$this->checkboxes->toggleCurrent();
$this->output->sameLine()->write($this->util->cursor->defaultStyle());
$this->output->sameLine()->write("\e[0m");
return true; // Break the while loop as well

case "\e":
$this->handleAnsi();
break;
}

return false;
}

/**
* Format the prompt string
*
* @return string
*/
protected function promptFormatted()
{
return $this->prompt . ' (press <Enter> to select)';
}
}

0 comments on commit 8e67973

Please sign in to comment.