ztcl::vt modes
Gives a dict of the modes of a terminal.
ztcl::vt modes HANDLE
Description
Gives a dict with these keys:
cursor_keys_app: 1 after DECCKM (ESC [?1h);keypad_app: 1 after DECNKM (ESC [?66h);cursor_visible: 0 afterESC [?25l;bracketed_paste: 1 afterESC [?2004h;focus_events: 1 afterESC [?1004h;mouse_sgr: 1 afterESC [?1006h;alt_screen: 1 while the alternate screen is active (ESC [?1049h);mouse:none,x10,normal,button, orany(modes 9, 1000, 1002, and 1003);cursor_style: the DECSCUSR number, 1 or 2 for a block, 3 or 4 for an underline, 5 or 6 for a bar. An odd number blinks.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| HANDLE | handle | required | A handle from new. |
Returns
A dict.
Examples
Each example of this page runs after package require ztcl::vt; set vt [ztcl::vt new].
% set t [ztcl::vt new]
> set r [ztcl::vt modes $t]
> ztcl::vt delete $t
> set r
cursor_keys_app 0 keypad_app 0 cursor_visible 1 bracketed_paste 0 focus_events 0 mouse_sgr 0 alt_screen 0 mouse none cursor_style 2
% set t [ztcl::vt new]
> ztcl::vt feed $t "\x1b\[?1049h\x1b\[?1000h\x1b\[?1006h"
> set m [ztcl::vt modes $t]
> ztcl::vt delete $t
> list [dict get $m alt_screen] [dict get $m mouse] [dict get $m mouse_sgr]
1 normal 1
% set t [ztcl::vt new]
> ztcl::vt feed $t "\x1b\[?25l\x1b\[4 q"
> set m [ztcl::vt modes $t]
> ztcl::vt delete $t
> list [dict get $m cursor_visible] [dict get $m cursor_style]
0 4
Errors
% ztcl::vt modes vt99
can not find terminal "vt99"
-errorcode ZTCL VT HANDLE
% ztcl::vt modes $vt x
wrong # args: should be "ztcl::vt modes handle"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1