beetlebug▾
/

ztcl::vt rows

Gives the text of the rows of a terminal.

ztcl::vt rows HANDLE ?FIRST? ?LAST?

Description

Gives a list with the text of each row from FIRST to LAST, with the blanks at the end of each row removed. Row 0 is the top of the active area, and a negative row is a line of the scrollback: -1 is its last line. With no index the list has each row of the active area, and with one index it has that row. An index outside the screen is clamped to the first or the last row, and a FIRST after LAST gives an empty list.

Arguments

ArgumentTypeDefaultDescription
HANDLEhandlerequiredA handle from new.
FIRSTintegernoneThe first row.
LASTintegernoneThe last row.

Returns

A list of strings.

Examples

Each example of this page runs after package require ztcl::vt; set vt [ztcl::vt new].

% set t [ztcl::vt new -size {10 2}]
> ztcl::vt feed $t "one\r\ntwo\r\nthree"
> set r [list [ztcl::vt rows $t] [ztcl::vt rows $t -1 1] [ztcl::vt rows $t 0]]
> ztcl::vt delete $t
> set r
{two three} {one two three} two

% set t [ztcl::vt new -size {10 2}]
> ztcl::vt feed $t "one\r\ntwo"
> set r [list [ztcl::vt rows $t -100 100] [ztcl::vt rows $t 1 0]]
> ztcl::vt delete $t
> set r
{one two} {}

Errors

% ztcl::vt rows vt99
can not find terminal "vt99"
-errorcode ZTCL VT HANDLE

% ztcl::vt rows $vt 0 1 2
wrong # args: should be "ztcl::vt rows|cells handle ?first? ?last?"
-errorcode TCL WRONGARGS

% ztcl::vt rows $vt end
expected integer but got "end"
-errorcode TCL VALUE NUMBER

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also