Initial work on Frame Edit

This commit is contained in:
Deon George
2019-07-31 20:19:41 +08:00
parent aa6b2f3244
commit bb031b1b82
7 changed files with 269 additions and 11 deletions

View File

@@ -39,6 +39,11 @@ class Ansi extends AbstractParser {
$y = $startline;
$output = '';
// Default Attributes
$f = 39;
$b = 49;
$i = 0;
// Scan the frame for a field start
for ($c=0; $c<=strlen($content); $c++)
{
@@ -76,17 +81,25 @@ class Ansi extends AbstractParser {
$advance += strlen($matches[0])-1;
$chars .= $matches[0];
if (! isset($this->frame_data[$y][$x]))
$this->frame_data[$y][$x] = '';
else
$this->frame_data[$y][$x] .= '|';
$this->frame_data[$y][$x] .= $matches[0];
switch ($matches[2]) {
// We ignore 'm' they are color CSIs
case 'm': break;
// Color CSIs
case 'm':
foreach (explode(';',chop($matches[0],'m')) as $num)
{
if ($num >= 0 AND $num <= 8)
{
$i = $num;
$f = 39;
$b = 49;
} elseif ($num >= 30 AND $num <= 39)
$f = $num;
elseif ($num >= 40 AND $num <= 49)
$b = $num;
}
break;
// Advance characters
case 'C':
$x += $matches[1]; // Advance our position
break;
@@ -127,10 +140,11 @@ class Ansi extends AbstractParser {
break;
default:
$this->frame_data[$y][$x] = ['i'=>$i,'f'=>$f,'b'=>$b];
$this->frame_content[$y][$x] = $byte;
$x++;
}
$this->frame_content[$y][$x] = $byte;
$output .= $byte;
if ($advance) {