Added ANSI parsers and rendering ANSI frames

This commit is contained in:
Deon George
2018-12-14 00:02:42 +11:00
parent e0306908bd
commit 6cc793c47f
14 changed files with 333 additions and 119 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Classes\Frame;
use Illuminate\Support\Facades\Log;
use App\Classes\Frame as AbstractFrame;
use App\Classes\Parser\Ansi as AnsiParser;
class Ansi extends AbstractFrame
{
@@ -18,9 +19,21 @@ class Ansi extends AbstractFrame
public static $if_filler = '.';
public function fields($startline=0)
public function __construct(\App\Models\Frame $o,string $msg='')
{
$this->output .= str_replace(LF,CR.LF,$this->frame->content);
parent::__construct($o);
// If we have a message to display on the bottom line.
if ($msg)
$this->output .= ESC.'[24;0f'.$msg.HOME;
}
public function fields($startline=1)
{
$o = new AnsiParser($this->frame->content,$startline);
$this->output .= (string)$o;
$this->fields = $o->fields;
}
public function strlenv($text):int {