tt_tab moved to ttinit.c
[unix-history] / usr / src / usr.bin / window / window.1
CommitLineData
7edc52ec 1.\" @(#)window.1 3.6 %G%
93d5bf32
EW
2.TH WINDOW 1 local
3.SH NAME
4window \- multiple window shell
5.SH SYNOPSIS
05631f05
EW
6.B window
7[
8.B \-t
9] [
10.B \-f
11] [
12.B \-d
13] [
14.B -e escape-char
15]
93d5bf32
EW
16.SH DESCRIPTION
17\fIWindow\fP provides a window oriented working environment
18on ordinary CRT terminals.
19.PP
20Windows are rectangular partitions on the physical terminal screen
f85ea165 21that are indistinguishable from real terminals to processes running in
05631f05 22them. Their sizes are determined at creation
93d5bf32
EW
23time. They are framed as necessary to mark the boundaries between
24windows. Each window, like terminals, has a cursor and a set of
25control functions. Most intelligent terminal functions such as line and
05631f05
EW
26character deletion and insertion are supported. Display modes
27such as underlining and reverse video are supported if the terminal
28allows them.
f85ea165 29.PP
430fecd4
EW
30Each window has a text buffer which can be larger than the window.
31Different parts of the buffer can be made visible through scrolling.
32.PP
e4414eae 33Windows are labeled with the digits ``1'' through ``9'',
05631f05 34thus a maximum of nine windows can exist at the same time.
93d5bf32 35One window, the current window, is treated specially.
05631f05 36This window is indicated by displaying its labels in reverse video.
f85ea165
EW
37.PP
38Windows can overlap. Some can be completely obscured by others.
bdfe3733 39The current window is always on top of all others.
93d5bf32 40.PP
9c9f7aa9
EW
41Windows need not be completely within the edges of the terminal screen.
42Thus a large window (possibly larger than the physical screen)
43can be placed to show only a portion of its full size. This
44feature can in some situations replace the ability to change
45window sizes which is not supported.
46.PP
05631f05
EW
47With each newly created window, a shell program is spawned with its
48process environment tailored to that window. In particular,
49a pseudo-terminal device (\fIpty (4)\fP) is allocated, and becomes
9c9f7aa9 50the standard input, output and diagnostic output of the shell. Its
05631f05
EW
51special characters and modes (see \fIstty (1)\fP) are copied from
52the user's real terminal. Also,
53a \fItermcap (5)\fP entry for this window is created
54and passed to the shell as \fIenviron (8)\fP
55variable \fBTERMCAP\fP. This \fItermcap\fP entry contains the window's
56size and characteristics as well as information about
57the real terminal, such as the existence of underline, reverse
58video and other display modes, and the codes produced by the terminal's
430fecd4
EW
59keypad (if any). The name of the shell program used is obtained from
60the environment variable \fBSHELL\fP.
05631f05
EW
61.PP
62When \fIwindow\fP starts up, the file \fI.windowrc\fP in the
63user's home directory is checked. If it exists, then the
64commands contained in it are executed (see \fIsource\fP command below).
65If \fI.windowrc\fP does not exist, then two
66equal sized windows are created by default.
67.PP
68The command line arguments are
69.TP
70.B -t
71Turn on terse mode (see \fIterse\fP command below).
72.TP
73.B -f
74Don't perform any startup action.
75.TP
76.B -d
77Ignore \fI.windowrc\fP and create the two default
78windows instead.
79.TP
80.B -e escape-char
81Set the escape character to \fIescape-char\fP.
82.PP
f85ea165
EW
83The \fIwindow\fP program has two functional modes: command mode
84and conversation mode.
f85ea165 85In conversation mode, the terminal's
93d5bf32
EW
86real cursor is placed at the cursor position of the current
87window and all keyboard input is sent to the process in that
88window. Output from windows is displayed at all times,
89even in command mode.
f85ea165
EW
90Typing \fIwindow\fP's escape character (normally ^P)
91in conversation mode switches \fIwindow\fP into
93d5bf32 92command mode. In command mode, the top line of the
05631f05 93terminal screen becomes the command prompt window.
93d5bf32 94.PP
e4414eae 95There are two types of commands. Short commands are
f07b3693
EW
96usually one or two key strokes. Long commands are
97in the command window (see the ``:'' command below),
98or read from a file (see \fIsource\fP below). They are parsed
99much like conventional programming languages, with a syntax
100similar to that of C. Numeric and string expressions and variables
101are supported, as well as
102conditional statements (if . . .). The grammar is described below.
e4414eae 103.PP
f07b3693
EW
104The short commands. Below, \fI[1-9]\fP represents one of the
105keys ``1'' through ``9,'' used to select the correponding window
106``1'' through ``9.''
93d5bf32
EW
107.TP
108.B [1-9]
f85ea165
EW
109Select window \fI[1-9]\fP as the current window
110and return to conversation mode.
93d5bf32
EW
111.TP
112.B %[1-9]
f85ea165 113Select window \fI[1-9]\fP but stay in command mode.
93d5bf32
EW
114.TP
115.B ?
116List a short summary of commands.
117.TP
f85ea165
EW
118.B ^L
119Redraw the screen.
120.TP
93d5bf32
EW
121.B escape
122Return to conversation mode.
123.TP
124.B ^P
125Return to conversation mode and write ^P to the
126current window. Thus, typing two ^P's in conversation
127mode sends one to the current window. If the \fIwindow\fP
128escape is changed to some other character, that
f85ea165 129character takes the place of ^P here.
93d5bf32 130.TP
9c9f7aa9
EW
131.B ^^
132Select the previous current window and return to conversation
133mode. This is useful for toggling between two windows.
134.TP
f85ea165
EW
135.B q
136Exit \fIwindow\fP. Confirmation is requested.
93d5bf32 137.TP
05631f05
EW
138.B ^Z
139Suspend \fIwindow\fP.
140.TP
93d5bf32 141.B w
f85ea165
EW
142Create a new window. You are prompted for the positions
143of the upper left and lower right corners of the window.
e4414eae
EW
144The cursor is placed on the screen and the keys ``h'', ``j'',
145``k'', and ``l''
146move the cursor left, down, up, and right, respectively.
147The keys ``H'', ``J'', ``K'', and ``L'' move the cursor to the respective
05631f05 148limits of the screen. Typing a number before the movement keys
f85ea165 149repeats the movement that number of times.
e4414eae 150Return enters the cursor position
93d5bf32 151as the upper left corner of the window. The lower right corner
f07b3693
EW
152is entered in the same manner. During this process,
153the position and size of the new window are indicated by a rectangular
154box drawn on the screen. Typing escape (or ^[) at any point
155cancels this command.
93d5bf32 156.IP
05631f05 157This window becomes the current window,
430fecd4
EW
158and is given the first available label. The default buffer size
159is used (see \fIbuffer\fP command below).
9c9f7aa9 160.IP
f07b3693 161Only fully visible windows can be created this way.
93d5bf32
EW
162.TP
163.B c[1-9]
05631f05 164Close window \fI[1-9]\fP. The process in the window is sent
f85ea165 165the hangup signal (see \fIkill (1)\fP). \fICsh (1)\fP should
93d5bf32
EW
166handle this signal correctly and cause no problems.
167.TP
168.B C
93d5bf32
EW
169Close all windows.
170.TP
9c9f7aa9 171.B m[1-9]
f07b3693
EW
172Move window \fI[1-9]\fP to another location. A box in the shape
173of the window is drawn on
174the screen to indicate the new position of the window, and the same keys as
175those for the ``w'' command are used to position the box. The
9c9f7aa9
EW
176window can be moved partially off-screen.
177.TP
178.B M[1-9]
179Move window \fI[1-9]\fP to its previous position.
180.TP
f85ea165 181.B S
93d5bf32
EW
182Show all windows. Each window is brought to the top in sequence,
183with the terminal cursor placed on its label. Typing escape
e4414eae 184at this point will select the displayed window as the current window.
f07b3693
EW
185Return will display the next one. This command is sometimes confusing,
186but useful when there are a large number of windows and some are completely
f85ea165 187hidden by others.
93d5bf32 188.TP
05631f05 189.B L
f07b3693 190List all windows with their labels and the states of their shell processes.
05631f05
EW
191.TP
192.B ^Y
193Scroll the current window up by one line.
194.TP
195.B ^E
196Scroll the current window down by one line.
197.TP
93d5bf32
EW
198.B ^U
199Scroll the current window up by half the window size.
200.TP
201.B ^D
202Scroll the current window down by half the window size.
203.TP
204.B ^B
205Scroll the current window up by the full window size.
206.TP
207.B ^F
208Scroll the current window down by the full window size.
209.TP
210.B h
211Move the cursor of the current window left by one column.
212.TP
213.B j
214Move the cursor of the current window down by one line.
215.TP
216.B k
217Move the cursor of the current window up by one line.
218.TP
219.B l
220Move the cursor of the current window right by one column.
221.TP
9c9f7aa9
EW
222.B v
223List all variables. All currently defined variables are listed
224with their values.
225.TP
f85ea165 226.B :
f07b3693
EW
227Enter a line to be executed as long commands. Normal line
228editing characters (erase character, erase word, erase line) are
229supported.
9c9f7aa9 230.PP
f07b3693
EW
231Long commands. A long command is either a conditional statement
232or a simple command. The simple long command consists of a
233command name followed by
234a list of arguments, terminated with newline or ``;''. A command can
235be continued on the next line by ending the first line with ``\\''. The
236arguments can be numeric or string expressions. Window supports both numeric
237and string values. A string is any word beginning with a letter or
238``_'', followed by letters, digits, or ``_''. Alternately, strings
239can be quoted in ``"'' to include non-alphanumeric characters. Numeric
240values are simple strings of digits. Boolean
241values are represented by a numeric value not equal to zero. The supported operators in increasing
9c9f7aa9
EW
242precedence are
243.TP
244.B "boolean_expr ? expr1 : expr2"
245Returns \fIexpr1\fP
246if \fIboolean_expr\fP is true, \fIexpr2\fP otherwise.
247.TP
248.B boolean_expr1 || boolean_expr2
249Logical or. Short circuit evaluation is supported.
250.TP
251.B boolean_expr1 && boolean_expr2
252Logical and, with short circuit evaluation.
253.TP
254.B numeric_expr1 | numeric_expr2
255Bitwise or.
256.TP
257.B numeric_expr1 ^ numeric_expr2
258Bitwise exclusive-or.
259.TP
260.B numeric_expr1 & numeric_expr2
261Bitwise and.
262.TP
263.B expr1 == expr2, expr1 != expr2
264Comparison (equal and not-equal, respectively). The boolean
265result of the comparison is returned. The arguments can be numeric
266or strings.
267.TP
268.B expr1 < expr2, expr1 > expr2, expr1 <= expr2, expr1 >= expr2
269Less than, greater than, less than or equal to, greater than or equal to.
270.TP
271.B numeric_expr1 << numeric_expr2, numeric_expr1 >> numeric_expr2,
272\fINumeric_expr1\fP is bit shifted left (or right) by \fInumeric_expr2\fP
273bits.
274.TP
275.B numeric_expr1 + numeric_expr2, numeric_expr1 - numeric_expr2
276Addition, subtraction.
277.TP
278.B numeric_expr1 * numeric_expr2, numeric_expr1 / numeric_expr2, numeric_expr1 % numeric_expr2
279Multiplication, division, modulo.
280.TP
281.B - numeric_expr, + numeric_expr, ~ numeric_expr, ! boolean_expr
282Unary minus, unary plus, bitwise complement, logical complement.
f85ea165 283.PP
e4414eae 284The long commands:
f85ea165
EW
285.TP
286.B escape C
287Set the escape character to \fIC\fP.
288.TP
289.B terse [off]
290Turn on (or off) terse mode. In terse mode, the command window
291stays hidden even in command mode, and errors are reported by
292sounding the terminal's bell.
293.TP
430fecd4 294.B window row col nrow ncol [nline]
f85ea165 295Open a window with upper left corner at \fIrow\fP, \fIcol\fP
430fecd4
EW
296and size \fInrow\fP, \fIncol\fP. If \fInline\fP is specified,
297then that many lines is allocated for the text buffer. Otherwise,
298the default buffer size is used. Using a \fB``*''\fP in place of
299\fIrow\fP, \fIcol\fP, \fInrow\fP, or \fIncol\fP gives, respectively,
300the up, left, down, or right extremes of the screen.
301.TP
302.B buffer nline
303Set the default buffer size to \fInline\fP. Initially, it is
30448 lines. Using a very large buffer can slow the program down
305considerably.
f85ea165
EW
306.TP
307.B label [1-9] string
05631f05 308Label window \fI[1-9]\fP with \fIstring\fP. This is in addition
e4414eae 309to the numeric label that is always displayed.
f85ea165
EW
310.TP
311.B %[1-9]
312Make window \fI[1-9]\fP the current window.
313.TP
05631f05
EW
314.B write [1-9] string
315Write \fIstring\fP to window \fI[1-9]\fP.
316.TP
317.B close [1-9] ...
318Close window \fI[1-9]\fP. More than one window can be specified.
319If no window is given, then all windows are closed.
320.TP
f85ea165 321.B source file
e4414eae 322Read and execute the long commands in \fIfile\fP. Recursive
f85ea165 323\fIsource\fP is not allowed.
93d5bf32
EW
324.SH FILES
325.ta 15
f85ea165
EW
326~/.windowrc startup command file.
327.br
93d5bf32 328/dev/ptyp? pseudo-terminal devices.
93d5bf32
EW
329.SH DIAGNOSTICS
330Should be self explanatory.
331.SH BUGS
93d5bf32
EW
332When a window is scrolled or the cursor moved, output from
333the process in the window will be displayed at the new cursor
334position. This is consistent with real terminals but
335not always desirable.