The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tickit::Term - terminal formatting abstraction

SYNOPSIS

DESCRIPTION

Provides terminal control primatives for Tickit; a number of methods that control the terminal by writing control strings. This object itself performs no acutal IO work; it writes bytes to a delegated object given to the constructor called the writer.

This object is not normally constructed directly by the containing application; instead it is used indirectly by other parts of the Tickit distribution.

CONSTRUCTOR

$term = Tickit::Term->new( %params )

Constructs a new Tickit::Term object.

Takes the following named arguments at construction time:

encoding => STRING

Optional. If supplied, applies the named encoding to the Unicode string supplied to the print and penprint methods.

writer => OBJECT

An object delegated to for sending strings of terminal control bytes to the terminal itself. This object must support a single method, write, taking a string of bytes.

 $writer->write( $data )

Such an interface is supported by an IO::Handle object.

METHODS

$term->print( $text )

Print the given text to the terminal at the current cursor position

$term->goto( $line, $col )

Move the cursor to the given position on the screen. If only one parameter is defined, does not alter the other. Both $line and $col are 0-based.

$term->move( $downward, $rightward )

Move the cursor relative to where it currently is.

$term->scroll( $from, $to, $by )

Scroll the region of the screen that starts on line $from until (and including) line $to down, $by lines (upwards if negative).

$term->chpen( %attrs )

Changes the current pen attributes to those given. Any attribute whose value is given as undef is reset. Any attributes not named are unchanged.

For details of the supported pen attributes, see Tickit::Pen.

$term->setpen( %attrs )

Similar to chpen, but completely defines the state of the terminal pen. Any attribute not given will be reset to its default value.

$term->clear

Erase the entire screen

$term->eraseinline

Clear the current line from the cursor onwards.

$term->erasech( $count, $moveend )

Erase $count characters forwards. If $moveend is true, the cursor is moved to the end of the erased region. If false, the cursor will remain where it is.

Using $moveend may be more efficient than separate erasech and goto calls on terminals that do not have an erase function, as it will be implemented by printing spaces. This removes the need for two cursor jumps.

$term->insertch( $count )

Insert $count blank characters, shifting following text to the right.

$term->deletech( $count )

Delete the following $count characters, shifting the remaining text to the left. The terminal will fill the empty region with blanks.

$term->mode_altscreen( $on )

Set or clear the DEC Alternate Screen mode

$term->mode_cursorvis( $on )

Set or clear the cursor visible mode

$term->mode_mouse( $on )

Set or clear the mouse tracking mode

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>