ANSI: PHP5 updates

This commit is contained in:
terrafrost 2015-05-23 18:23:40 -05:00
parent e4fee53c93
commit 6c345acc1d
2 changed files with 7 additions and 7 deletions

View File

@ -172,8 +172,8 @@ class ANSI
$attr_cell->background = 'black'; $attr_cell->background = 'black';
$attr_cell->foreground = 'white'; $attr_cell->foreground = 'white';
$attr_cell->reverse = false; $attr_cell->reverse = false;
$this->base_attr_cell = clone($attr_cell); $this->base_attr_cell = clone $attr_cell;
$this->attr_cell = clone($attr_cell); $this->attr_cell = clone $attr_cell;
$this->setHistory(200); $this->setHistory(200);
$this->setDimensions(80, 24); $this->setDimensions(80, 24);
@ -314,7 +314,7 @@ class ANSI
foreach ($mods as $mod) { foreach ($mods as $mod) {
switch ($mod) { switch ($mod) {
case 0: // Turn off character attributes case 0: // Turn off character attributes
$attr_cell = clone($this->base_attr_cell); $attr_cell = clone $this->base_attr_cell;
break; break;
case 1: // Turn bold mode on case 1: // Turn bold mode on
$attr_cell->bold = true; $attr_cell->bold = true;
@ -382,7 +382,7 @@ class ANSI
case "\x08": // backspace case "\x08": // backspace
if ($this->x) { if ($this->x) {
$this->x--; $this->x--;
$this->attrs[$this->y][$this->x] = clone($this->base_attr_cell); $this->attrs[$this->y][$this->x] = clone $this->base_attr_cell;
$this->screen[$this->y] = substr_replace( $this->screen[$this->y] = substr_replace(
$this->screen[$this->y], $this->screen[$this->y],
$source[$i], $source[$i],
@ -401,7 +401,7 @@ class ANSI
$this->ansi.= "\x1B"; $this->ansi.= "\x1B";
break; break;
default: default:
$this->attrs[$this->y][$this->x] = clone($this->attr_cell); $this->attrs[$this->y][$this->x] = clone $this->attr_cell;
if ($this->x > strlen($this->screen[$this->y])) { if ($this->x > strlen($this->screen[$this->y])) {
$this->screen[$this->y] = str_repeat(' ', $this->x); $this->screen[$this->y] = str_repeat(' ', $this->x);
} }

View File

@ -5,7 +5,7 @@
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
*/ */
require_once 'File/ANSI.php'; use phpseclib\File\ANSI;
class Unit_File_ANSITest extends PhpseclibTestCase class Unit_File_ANSITest extends PhpseclibTestCase
{ {
@ -17,7 +17,7 @@ class Unit_File_ANSITest extends PhpseclibTestCase
$str.= "\x1B[m"; // reset everything $str.= "\x1B[m"; // reset everything
$str.= "bbb"; $str.= "bbb";
$ansi = new File_ANSI(); $ansi = new ANSI();
$ansi->appendString($str); $ansi->appendString($str);
$expected = '<pre width="80" style="color: white; background: black">'; $expected = '<pre width="80" style="color: white; background: black">';