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



   $state->reset( $hard )

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


   $pos = $state->get_cursorpos

Returns the current cursor position as a VTermPos object.


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

Returns the default foreground and background colors from the palette as instances of VTermColor.


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

Sets the default foreground and backgroudn colors to the palette from instances of VTermColor.


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

Returns the palette color at the given index as an instance of VTermColor.


   $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 VTermColor.


   $state->set_callbacks( %cbs )

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

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

$glyphinfo is a VTermGlyphInfo structure. $pos is a VTermPos.

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

$pos and $oldpos are a VTermPos. $is_visible is a boolean.

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

$rect is a VTermRect structure. $downward and $rightward are integers.

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

$dest and $src are VTermRect structures.

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

$rect is a VTermRect structure. $is_selective is a boolean.

on_initpen => CODE
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_setlineinfo => CODE
 $on_setlineinfo->( $row, $lineinfo, $oldlineinfo )

$row is an integer. $lineinfo and $oldlineinfo are VTermLineInfo structures.


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

Converts a VTermColor structure from indexed to RGB form.


Paul Evans <>