summary refs log tree commit diff
path: root/Doc/Zsh/mod_curses.yo
blob: 4198038e1971f54c1e33991a4a107485bee691f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
COMMENT(!MOD!zsh/curses
curses windowing commands
!MOD!)
The tt(zsh/curses) module makes available one builtin command and
various parameters.

subsect(Builtin)

startitem()
findex(zcurses)
cindex(windows, curses)
xitem(tt(zcurses) tt(init))
xitem(tt(zcurses) tt(end))
xitem(tt(zcurses) tt(addwin) var(targetwin) var(nlines) var(ncols) var(begin_y) var(begin_x) )
xitem(tt(zcurses) tt(delwin) var(targetwin) )
xitem(tt(zcurses) tt(refresh) [ var(targetwin) ] )
xitem(tt(zcurses) tt(move) var(targetwin) var(new_y) var(new_x) )
xitem(tt(zcurses) tt(clear) var(targetwin) [ tt(redraw) | tt(eol) | tt(bot) ])
xitem(tt(location) var(targetwin) var(array))
xitem(tt(zcurses) tt(char) var(targetwin) var(character) )
xitem(tt(zcurses) tt(string) var(targetwin) var(string) )
xitem(tt(zcurses) tt(border) var(targetwin) var(border) )(
xitem(tt(zcurses) tt(attr) var(targetwin) [ var({+/-}attribute) | var(fg_col)tt(/)var(bg_col) ] [...])
xitem(tt(zcurses) tt(scroll) [ tt(on) | tt(off) | {+/-}var(lines) ])
item(tt(input) var(targetwin) [ var(param) [ var(kpparm) ] ])(
Manipulate curses windows.  All uses of this command should be
bracketed by `tt(zcurses init)' to initialise use of curses, and
`tt(zcurses end)' to end it; omitting `tt(zcurses end)' can cause
the terminal to be in an unwanted state.

With tt(addwin), create a window with var(nlines) lines and var(ncols) columns.
Its upper left corner will be placed at row var(begin_y) and column
var(begin_x) of the screen.  var(targetwin) is a string and refers
to the name of a window that is not currently assigned.  Note
in particular the curses convention that vertical values appear
before horizontal values.

Use tt(delwin) to delete a window created with tt(addwin).  Note
that tt(end) does em(not) implicitly delete windows, and that
tt(delwin) does not erase the screen image of the window.

The window corresponding to the full visible screen is called
tt(stdscr); it always exists after `tt(zcurses init)' and cannot
be delete with tt(delwin).

The tt(refresh) command will refresh window var(targetwin); this is
necessary to make any pending changes (such as characters you have
prepared for output with tt(char)) visible on the screen.  tt(refresh)
without an argument causes the screen to be cleared and redrawn.

tt(move) moves the cursor position in var(targetwin) to new coordinates
var(new_y) and var(new_x).

tt(clear) erases the contents of var(targetwin).  One (and no more than one)
of three options may be specified.  With the option tt(redraw),
in addition the next tt(refresh) of var(targetwin) will cause the screen to be
cleared and repainted.  With the option tt(eol), var(targetwin) is only
cleared to the end of the current cursor line.  With the option
tt(bot), var(targetwin) is cleared to the end of the window, i.e
everything to the right and below the cursor is cleared.

tt(location) writes various positions associated with var(targetwin)
into the array named var(array).
These are, in order:
startsitem()
sitem()(The y and x coordinates of the cursor relative to the top left
of var(targetwin))
sitem()(The y and x coordinates of the top left of var(targetwin) on the
screen)
sitem()(The size of var(targetwin) in y and x dimensions.)
endsitem()

Outputting characters and strings are achieved by tt(char) and tt(string)
respectively.

To draw a border around window var(targetwin), use tt(border).  Note
that the border is not subsequently handled specially:  in other words,
the border is simply a set of characters output at the edge of the
window.  Hence it can be overwritten, can scroll off the window, etc.

tt(attr) will set var(targetwin)'s attributes or foreground/background
color pair for any successive character output.  Each var(attribute)
given on the line may be prepended by a tt(+) to set or a tt(-) to
unset that attribute; tt(+) is assumed if absent.  The attributes
supported are tt(blink), tt(bold), tt(dim), tt(reverse), tt(standout),
and tt(underline).  Each var(fg_col)tt(/)var(bg_col) (to be read as
`var(fg_col) on var(bg_col)') sets the foreground and background color
for character output.

tt(scroll) can be used with tt(on) or tt(off) to enabled or disable
scrolling of a window when the cursor would otherwise move below the
window due to typing or output.  It can also be used with a positive
or negative integer to scroll the window up or down the given number
of lines without changing the current cursor position (which therefore
appears to move in the opposite direction relative to the window).
In the second case, if scrolling is tt(off) it is temporarily turned tt(on)
to allow the window to be scrolled.

tt(input) reads a single character from the window without echoing
it back.  If var(param) is supplied the character is assigned to the
parameter var(param), else it is assigned to the parameter var(REPLY).
If both var(param) and var(kpparam) are supplied, the key is read
in `keypad' mode.  In this mode special keys such as function keys
and arrow keys return the name of the key in the parameter var(kpparam).
The key names are the macros defined in the tt(curses.h) or tt(ncurses.h)
with the prefix `tt(KEY_)' removed.  Other keys cause a value to be set in
var(param) as before.  On a succesful return only one of var(param) or
var(kpparm) contains a non-empty string; the other is set to an empty
string.
)
enditem()

subsect(Parameters)

startitem()
vindex(ZCURSES_COLORS)
item(tt(ZCURSES_COLORS))(
Readonly integer.  The maximum number of colors the terminal
supports.  This value is initialised by the curses library and is not
available until the first time tt(zcurses init) is run.
)
vindex(ZCURSES_COLOR_PAIRS)
item(tt(ZCURSES_COLOR_PAIRS))(
Readonly integer.  The maximum number of color pairs
var(fg_col)tt(/)var(bg_col) that may be defined in `tt(zcurses attr)'
commands; note this limit applies to all color pairs that have been
used whether or not they are currently active.  This value is initialised
by the curses library and is not available until the first time tt(zcurses
init) is run.
)
vindex(zcurses_attrs)
item(tt(zcurses_attrs))(
Readonly array.  The attributes supported by tt(zsh/curses); available
as soon as the module is loaded.
)
vindex(zcurses_colors)
item(tt(zcurses_colors))(
Readonly array.  The colors supported by tt(zsh/curses); available
as soon as the module is loaded.
)
vindex(zcurses_windows)
item(tt(zcurses_windows))(
Readonly array.  The current list of windows, i.e. all windows that
have been created with `tt(zcurses addwin)' and not removed with
`tt(zcurses delwin)'.
)
enditem()