beetlebug▾
/

ztcl::vt cells

Gives the cells of the rows of a terminal.

ztcl::vt cells HANDLE ?FIRST? ?LAST?

Description

Gives one list for each row from FIRST to LAST, with the same indexes as rows. Each row is a list of COLS cells, and a cell is the list TEXT WIDTH FG BG ATTRS:

Arguments

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

Returns

A list of rows, each a list of cells.

Examples

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

% set t [ztcl::vt new -size {4 1}]
> ztcl::vt feed $t "\x1b\[1;31mA\x1b\[0m\x1b\[48;2;0;128;255mB\x1b\[0m中"
> set r [lindex [ztcl::vt cells $t 0] 0]
> ztcl::vt delete $t
> lrange $r 0 1
{A 1 1 {} bold} {B 1 {} #0080ff {}}

% set t [ztcl::vt new -size {4 1}]
> ztcl::vt feed $t "ab中"
> set r [lindex [ztcl::vt cells $t 0] 0]
> ztcl::vt delete $t
> list [lindex $r 2 1] [lindex $r 3]
2 {{} 0 {} {} {}}

% set t [ztcl::vt new -size {3 1}]
> ztcl::vt feed $t "\x1b\[38;5;200;2;3;4;5;7;8;9mq"
> set r [lindex [ztcl::vt cells $t 0] 0 0]
> ztcl::vt delete $t
> set r
q 1 200 {} {dim italic underline blink inverse hidden strike}

Errors

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

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

Facts

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

See also