Skip to content

ANSI

Pure-PHP ANSI Decoder

  • Full name: \phpseclib\File\ANSI

Properties

max_x

Max Width

public int $max_x

max_y

Max Height

public int $max_y

max_history

Max History

public int $max_history

history

History

public array $history

history_attrs

History Attributes

public array $history_attrs

x

Current Column

public int $x

y

Current Row

public int $y

old_x

Old Column

public int $old_x

old_y

Old Row

public int $old_y

base_attr_cell

An empty attribute cell

public object $base_attr_cell

attr_cell

The current attribute cell

public object $attr_cell

attr_row

An empty attribute row

public array $attr_row

screen

The current screen text

public array $screen

attrs

The current screen attributes

public array $attrs

ansi

Current ANSI code

public string $ansi

tokenization

Tokenization

public array $tokenization

Methods

__construct

Default Constructor.

public __construct(): \phpseclib\File\ANSI

setDimensions

Set terminal width and height

public setDimensions(int $x, int $y): mixed

Resets the screen as well

Parameters:

Parameter Type Description
$x int
$y int

setHistory

Set the number of lines that should be logged past the terminal height

public setHistory(int $history): mixed

Parameters:

Parameter Type Description
$history int

loadString

Load a string

public loadString(string $source): mixed

Parameters:

Parameter Type Description
$source string

appendString

Appdend a string

public appendString(string $source): mixed

Parameters:

Parameter Type Description
$source string

_newLine

Add a new line

public _newLine(): mixed

Also update the $this->screen and $this->history buffers


_processCoordinate

Returns the current coordinate without preformating

public _processCoordinate(mixed $last_attr, mixed $cur_attr, mixed $char): string

Parameters:

Parameter Type Description
$last_attr mixed
$cur_attr mixed
$char mixed

_getScreen

Returns the current screen without preformating

public _getScreen(): string

getScreen

Returns the current screen

public getScreen(): string

getHistory

Returns the current screen and the x previous lines

public getHistory(): string


Automatically generated on 2025-03-18