- EXPORTED CONSTANTS
- COLOR OBJECTS
- GLYPH INFO OBJECTS
- POSITION OBJECTS
- RECTANGLE OBJECTS
Term::VTerm - emulate a virtual terminal using libvterm
The following sets of constants are exported, with the given tag names.
Type constants for the types of
VTermValue, as returned by
Attribute constants for pen attributes.
Property constants for terminal properties.
Keyboard modifier bitmask constants for
Size constants for
VTermScreen damage merging.
Key symbol constants for
$vterm = Term::VTerm->new( %args )
Constructs a new
Term::VTerm instance of the initial size given by the arguments.
( $rows, $cols ) = $vterm->get_size
Returns the current size of the terminal area.
$vterm->set_size( $rows, $cols )
Sets the new size of the terminal area.
$utf8 = $vterm->get_utf8 $vterm->set_utf8( $utf8 )
Return or set UTF-8 mode on the parser.
$len = $vterm->input_write( $str )
Writes the bytes of the given string into the terminal parser buffer.
$len = $vterm->output_read( $buf, $maxlen )
Reads bytes from the output buffer of the terminal into the given variable, up to the maximum length requested. Returns the number of bytes actually read.
$vterm->keyboard_unichar( $char, $mod )
Sends a keypress to the output buffer, encoding the given Unicode character number (i.e. not a string), with the optional modifier (as a bitmask of one or more of the
$vterm->keyboard_key( $key, $mod )
Sends a keypress to the output buffer, encoding the given key symbol (as a
KEY_* constant), with the optional modifier (as a bitmask of one or more of the
$vterm->mouse_move( $row, $col, $mod )
Moves the mouse cursor to the given position, with optional modifier (as a bitmask of one or more of the
MOD_* constants). It is OK to call this regardless of the current mouse mode; if the mode doesn't want move report events or drag events then no output will be generated.
$vterm->mouse_button( $button, $is_pressed, $mod )
Performs a mouse button report event on the given button, to either press or release it, with optional modifier (as a bitmask of one or more of the
MOD_* constants). It is OK to call this regardless of the current mouse mode; if mouse reporting is disabled then no output will be generated.
$vterm->parser_set_callbacks( %cbs )
Sets the parser-layer callbacks. Takes the following named arguments:
- on_text => CODE
$on_text->( $text )
- on_control => CODE
$on_control->( $ctrl )
$ctrlis an integer giving a C0 or C1 control byte value.
- on_escape => CODE
$on_escape->( $str )
- on_csi => CODE
$on_csi->( $leader, $command, @args )
undef, and each element of
@argsis an ARRAY reference containing sub-arguments. Each sub-argument may be
- on_osc => CODE
$on_osc->( $command )
- on_dcs => CODE
$on_dcs->( $str )
- on_resize => CODE
$on_resize->( $rows, $cols )
$state = $vterm->obtain_state
Returns a Term::VTerm::State object representing the terminal state layer, creating it if necessary. After calling this method, any parser callbacks will no longer work.
$screen = $vterm->obtain_screen
Returns a Term::VTerm::Screen object representing the terminal screen layer, creating it if necessary. After calling this method, any parser or state callbacks will no longer work.
VTermColor instance can be constructed by
VTermColor instance has the following field accessors:
True if the colour is a palette index.
True if the colour contains RGB values directly.
The palette index for indexed colours.
The components of the colour as an integer between 0 and 255 for RGB colours.
A 6-character string containing the three colour components, hex encoded.
True if the colour is the default colour for terminal foreground or background.
VTermGlyphInfo instance has the following field accessors:
A list of Unicode character numbers. This list does not include the terminating 0.
The width of this glyph in screen columns.
A Unicode string containing the characters.
VTermPos instance can be constructed by
VTermPos instance has the following field accessors:
The row and column number of the position, 0-indexed.
VTermRect instance can be constructed by
$rect = Term::VTerm::Rect->new( start_row => ..., end_row => ..., start_col => ..., end_col => ... )
VTermRect instance has the following field accessors:
The row and column number of the top left corner of the rectangle.
The row and column number of the cell just after the bottom right corner of the rectangle; i.e. exclusive limit.
The following utility functions are also exported.
$type = get_attr_type( $attr )
Returns the type of the given pen attribute.
$type = get_prop_type( $prop )
Returns the type of the given terminal property.
Paul Evans <email@example.com>