beetlebug▾
/

ztcl::pty resize

Sets the size of the terminal.

ztcl::pty resize CHANNEL COLS ROWS

Description

Sets the size of the terminal, and the program gets the change: SIGWINCH on Linux and macOS, and the console event on Windows. The limits are those of -size.

Arguments

ArgumentTypeDefaultDescription
CHANNELchannelrequiredA channel of spawn.
COLSintegerrequiredThe count of columns.
ROWSintegerrequiredThe count of rows.

Returns

An empty string.

Examples

Each example of this page runs after # The shell of the platform: in host mode the separator of Windows is a backslash. set sh [expr {[file separator] eq "/" ? "/bin/sh" : "cmd.exe"}] # Reads the output with no block until the program ends, and gives its status. proc finish {t} { fconfigure $t -blocking 0 for {set n 0} {[ztcl::pty status $t] eq "running" && $n < 1000} {incr n} { read $t; after 10 } ztcl::pty status $t } .

% set t [ztcl::pty spawn $sh]
> ztcl::pty resize $t 120 40
> set r [ztcl::pty size $t]
> close $t
> set r
120 40

Errors

% ztcl::pty resize stdout 1 1
channel "stdout" is not a pty
-errorcode NONE

% set t [ztcl::pty spawn $sh]
> catch {ztcl::pty resize $t a 5} m o
> close $t
> return -options $o $m
expected integer but got "a"
-errorcode TCL VALUE NUMBER

% ztcl::pty resize stdout
wrong # args: should be "ztcl::pty resize channel cols rows"
-errorcode TCL WRONGARGS

Facts

Capability
exec. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also