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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ php:
- 5.4
- 5.5
- 5.6
- 7
- 7.0
- 7.1
- 7.2
- 7.3
- hhvm # ignore errors, see below

# lock distro so future defaults will not break the build
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"require-dev": {
"clue/arguments": "^2.0",
"clue/commander": "^1.2",
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35"
},
"config": {
"sort-packages": true
Expand Down
31 changes: 23 additions & 8 deletions src/Readline.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(ReadableStreamInterface $input, WritableStreamInterf
"\033[D" => 'onKeyLeft',

"\033[1~" => 'onKeyHome',
"\033[2~" => 'onKeyInsert',
// "\033[2~" => 'onKeyInsert',
"\033[3~" => 'onKeyDelete',
"\033[4~" => 'onKeyEnd',

Expand Down Expand Up @@ -514,12 +514,6 @@ public function onKeyDelete()
$this->deleteChar($this->linepos);
}

/** @internal */
public function onKeyInsert()
{
// TODO: toggle insert mode
}

/** @internal */
public function onKeyHome()
{
Expand Down Expand Up @@ -796,6 +790,11 @@ protected function processLine($eol)
$this->emit('data', array($line . $eol));
}

/**
* @param string $str
* @return int
* @codeCoverageIgnore
*/
private function strlen($str)
{
// prefer mb_strlen() if available
Expand All @@ -807,6 +806,13 @@ private function strlen($str)
return strlen(preg_replace('/./us', '.', $str));
}

/**
* @param string $str
* @param int $start
* @param ?int $len
* @return string
* @codeCoverageIgnore
*/
private function substr($str, $start = 0, $len = null)
{
if ($len === null) {
Expand All @@ -824,7 +830,12 @@ private function substr($str, $start = 0, $len = null)
return implode('', array_slice($matches[0], $start, $len));
}

/** @internal */
/**
* @internal
* @param string $str
* @return int
* @codeCoverageIgnore
*/
public function strwidth($str)
{
// prefer mb_strwidth() if available
Expand All @@ -849,6 +860,10 @@ public function strwidth($str)
));
}

/**
* @param string $str
* @return string[]
*/
private function strsplit($str)
{
return preg_split('//u', $str, null, PREG_SPLIT_NO_EMPTY);
Expand Down