Styling, abbreviated commands

This commit is contained in:
2024-02-27 22:07:38 +01:00
parent 17064e7e43
commit ba27d840ea
2 changed files with 20 additions and 3 deletions

View File

@ -35,7 +35,9 @@ class Shell implements WritableStreamInterface, EventEmitterInterface
private int $promptWidth = 0;
private string $promptStyle = "35;1";
private string $promptStyle = "36;1";
private string $inputStyle = "36";
public function __construct(?ReadableStreamInterface $input=null, ?WritableStreamInterface $output=null)
{
@ -191,8 +193,8 @@ class Shell implements WritableStreamInterface, EventEmitterInterface
$obuf = "\r" . "\e[{$this->promptStyle}m" . $this->prompt . "\e[0m";
$ostr = mb_substr($this->buffer, $this->scrollOffset) . " ";
$ostr = mb_substr($ostr, 0, $this->termWidth - $this->promptWidth);
$obuf .= $ostr . "\e[K\e[" . $pos . "G";
$obuf .= "\e[{$this->inputStyle}m" . $ostr . "\e[K\e[0m\e[" . $pos . "G";
$this->ostream->write($obuf);
}
}
}