NAME

Term::VTerm::State - provides access to the state layer of libvterm

METHODS

reset

$state->reset( $hard )

Resets the terminal state; performing either a soft or hard reset depending on the (optional) boolean value given.

get_cursorpos

$pos = $state->get_cursorpos

Returns the current cursor position as a Term::VTerm::Pos object.

get_default_colors

( $fg, $bg ) = $state->get_default_colors

Returns the default foreground and background colors from the palette as instances of Term::VTerm::Color.

set_default_colors

$state->set_default_colors( $fg, $bg )

Sets the default foreground and backgroudn colors to the palette from instances of Term::VTerm::Color.

get_palette_color

$col = $state->get_palette_color( $index )

Returns the palette color at the given index as an instance of Term::VTerm::Color.

get_penattr

$value = $state->get_penattr( $attr )

Returns the current value of the given pen attribute (as one of the ATTR_* constants). Boolean, integer or string attributes are represented as native perl values. Color attributes return an instance of Term::VTerm::Color.

set_callbacks

$state->set_callbacks( %cbs )

Sets the state-layer callbacks. Takes the following named arguments:

on_putglyph => CODE
$on_putglyph->( $glyphinfo, $pos )

$glyphinfo is a Term::VTerm::GlyphInfo instance. $pos is a Term::VTerm::Pos.

on_movecursor => CODE
$on_movecursor->( $pos, $oldpos, $is_visible )

$pos and $oldpos are a Term::VTerm::Pos. $is_visible is a boolean.

on_scrollrect => CODE
$on_scrollrect->( $rect, $downward, $rightward )

$rect is a Term::VTerm::Rect instance. $downward and $rightward are integers.

on_moverect => CODE
$on_moverect->( $dest, $src )

$dest and $src are Term::VTerm::Rect instances.

on_erase => CODE
$on_erase->( $rect, $is_selective )

$rect is a Term::VTerm::Rect instance. $is_selective is a boolean.

on_initpen => CODE
$on_initpen->()
on_setpenattr => CODE
$on_setpenattr->( $attr, $value )

$attr is one of the ATTR_* constants. The type of $value depends on the attribute type - see get_penattr.

on_settermprop => CODE
$on_settermprop->( $prop, $value )

$prop is one of the PROP_* constants. The type of $value depends on the property type - see similar to get_penattr.

on_setmousemode => CODE
$on_setmousemode->( $mode )

$mode is one of the MOUSE_* constants.

on_bell => CODE
$on_bell->()
on_setlineinfo => CODE
$on_setlineinfo->( $row, $lineinfo, $oldlineinfo )

$row is an integer. $lineinfo and $oldlineinfo are Term::VTerm::LineInfo instances.

set_selection_callbacks

$state->set_selection_callbacks( %cbs )

Sets the state-layer selection callbacks. Takes the following named arguments:

on_set
$on_set->( $mask, $content )

$mask is a bitmask of SELECTION_* constants. $content is a plain perl string.

on_query
$on_query->( $mask )

$mask is a bitmask of SELECTION_* constants.

send_selection

$state->send_selection( $mask, $content )

Sends the selection, likely in response of a selection query request. $mask is a bitmask of SELECTION_* constants. $content is a plain perl string.

convert_color_to_rgb

$col = $state->convert_color_to_rgb( $col )

Converts a Term::VTerm::Color instance from indexed to RGB form.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>