Blob


1 .TH 9TERM 1
2 .SH NAME
3 9term \- terminal windows
4 .SH SYNOPSIS
5 .B 9term
6 [
7 .B -as
8 ]
9 [
10 .B -f
11 .I font
12 ]
13 [
14 .I cmd
15 \&...
16 ]
17 .SH DESCRIPTION
18 .I 9term
19 is a terminal window program for the X Window System,
20 providing an interface similar to that used on Plan 9.
21 .SS Command
22 The
23 .I 9term
24 command starts a new window.
25 .PP
26 The
27 .B -a
28 flag causes button 2 to send the selection immediately, like acme.
29 Otherwise button 2 brings up a menu, described below.
30 .PP
31 The
32 .B -s
33 option initializes windows so that text scrolls;
34 the default is not to scroll.
35 .PP
36 The
37 .I font
38 argument to
39 .B -f
40 names a font used to display text, both in
41 .IR 9term 's
42 menus
43 and as a default for any programs running in its windows; it also
44 establishes the
45 environment variable
46 .BR $font .
47 If
48 .B -f
49 is not given,
50 .I 9term
51 uses the imported value of
52 .B $font
53 if set; otherwise it uses the graphics system default.
54 .PP
55 .I 9term
56 runs the given command in the window, or
57 .B $SHELL
58 if no command is given.
59 .SS Text windows
60 Characters typed on the keyboard
61 collect in the window to form
62 a long, continuous document.
63 .PP
64 There is always some
65 .I selected
66 .IR text ,
67 a contiguous string marked on the screen by reversing its color.
68 If the selected text is a null string, it is indicated by a hairline cursor
69 between two characters.
70 The selected text
71 may be edited by mousing and typing.
72 Text is selected by pointing and clicking button 1
73 to make a null-string selection, or by pointing,
74 then sweeping with button 1 pressed.
75 Text may also be selected by double-clicking:
76 just inside a matched delimiter-pair
77 with one of
78 .B {[(<`'"
79 on the left and
80 .B }])>`'"
81 on the right, it selects all text within
82 the pair; at the beginning
83 or end of a line, it selects the line; within or at the edge of an alphanumeric word,
84 it selects the word.
85 .PP
86 Characters typed on the keyboard replace the selected text;
87 if this text is not empty, it is placed in a
88 .I snarf buffer
89 common to all windows but distinct from that of
90 .IR sam (1).
91 .PP
92 Programs access the text in the window at a single point
93 maintained automatically by
94 .IR 9term .
95 The
96 .I output point
97 is the location in the text where the next character written by
98 a program to the terminal
99 will appear; afterwards, the output point is the null string
100 beyond the new character.
101 The output point is also the location in the text of the next character
102 that will be read (directly from the text in the window,
103 not from an intervening buffer)
104 by a program.
105 Since Unix does not make it possible to know when a program
106 is reading the terminal, lines are sent as they are completed
107 (when the user types a newline character).
108 .PP
109 In general there is text in the window after the output point,
110 usually placed there by typing but occasionally by the editing
111 operations described below.
112 A pending read of the terminal
113 will block until the text after the output point contains
114 a newline, whereupon the read may
115 acquire the text, up to and including the newline.
116 After the read, as described above, the output point will be at
117 the beginning of the next line of text.
118 In normal circumstances, therefore, typed text is delivered
119 to programs a line at a time.
120 Changes made by typing or editing before the text is read will not
121 be seen by the program reading it.
122 Because of the Unix issues mentioned above, a line of text is only editable
123 until it is completed with a newline character, or when hold mode
124 (see below) is enabled.
125 .PP
126 Even when there are newlines in the output text,
127 .I 9term
128 will not honor reads if the window is in
129 .I hold
130 .IR mode ,
131 which is indicated by a white cursor and blue text and border.
132 The ESC character toggles hold mode.
133 Some programs
134 automatically turn on hold mode to simplify the editing of multi-line text;
135 type ESC when done to allow
136 .I mail
137 to read the text.
138 .PP
139 An EOT character (control-D) behaves exactly like newline except
140 that it is not delivered to a program when read.
141 Thus on an empty line an EOT serves to deliver an end-of-file indication:
142 the read will return zero characters.
143 .\" Like newlines, unread EOTs may be successfully edited out of the text.
144 The BS character (control-H) erases the character before the selected text.
145 The ETB character (control-W) erases any nonalphanumeric characters, then
146 the alphanumeric word just before the selected text.
147 `Alphanumeric' here means non-blanks and non-punctuation.
148 The NAK character (control-U) erases the text after the output point,
149 and not yet read by a program, but not more than one line.
150 All these characters are typed on the keyboard and hence replace
151 the selected text; for example, typing a BS with a word selected
152 places the word in the snarf buffer, removes it from the screen,
153 and erases the character before the word.
154 .PP
155 An ACK character (control-F) or Insert character triggers file name completion
156 for the preceding string (see
157 .IR complete (3)).
158 .PP
159 Text may be moved vertically within the window.
160 A scroll bar on the left of the window shows in its clear portion what fragment of the
161 total output text is visible on the screen, and in its gray part what
162 is above or below view;
163 it measures characters, not lines.
164 Mousing inside the scroll bar moves text:
165 clicking button 1 with the mouse pointing inside the scroll bar
166 brings the line at the top of the
167 window to the cursor's vertical location;
168 button 3 takes the line at the cursor to the top of the window;
169 button 2, treating the scroll bar as a ruler, jumps to the indicated portion
170 of the stored text.
171 Holding a button pressed in the scroll bar will cause the text
172 to scroll continuously until the button is released.
173 .PP
174 Typing down-arrow scrolls forward
175 one third of a window, and up-arrow scrolls back.
176 Typing page-down scrolls forward
177 two thirds of a window, and page-up scrolls back.
178 Typing Home scrolls to the top of the window;
179 typing End scrolls to the end.
180 .PP
181 The DEL character sends an
182 .L interrupt
183 note to all processes in the window's process group.
184 Unlike the other characters, the DEL and arrow
185 keys do not affect the selected text.
186 The left (right) arrow key moves the selection to one character
187 before (after) the current selection.
188 .PP
189 .I 9term
190 relies on the kernel's terminal processing to handle
191 EOT and DEL, so the terminal must be set up with EOT
192 as the ``eof'' character and DEL as the ``intr'' character.
193 .I 9term
194 runs
195 .IR stty (1)
196 to establish this when the terminal is created.
197 .PP
198 Normally, written output to a window blocks when
199 the text reaches the end of the screen and the terminal
200 buffer fills;
201 a button 2 menu item toggles scrolling.
202 .PP
203 .I 9term
204 changes behavior according to
205 the terminal settings of the running programs.
206 Most programs run with echo enabled.
207 In this mode,
208 .I 9term
209 displays and allows editing of the input.
210 Some programs, typically those reading passwords,
211 run with echo disabled.
212 In this mode,
213 .I 9term
214 passes keystrokes through directly, without
215 echoing them or buffering until a newline character.
216 These heuristics work well in many cases, but there
217 are a few common ones where they fall short.
218 First, programs using the GNU readline library typically
219 disable terminal echo and perform echoing themselves.
220 The most common example is the shell
221 .IR bash (1).
222 Disabling the use of readline with
223 .RB `` "set +o emacs" ''
224 .RI [ sic ]
225 usually restores the desired behavior.
226 Second, remote terminal programs such as
227 .IR ssh (1)
228 typically run with echo disabled, relying on the
229 remote system to echo characters as desired.
230 Plan 9's
231 .I ssh
232 has a
233 .B -C
234 flag to disable this, leaving the terminal in ``cooked'' mode.
235 For similar situations on Unix,
236 .IR 9term 's
237 button 2 menu has an entry to toggle the forced use of
238 cooked mode, despite the terminal settings.
239 In such cases, it is useful to run
240 .RB `` "stty -echo" ''
241 on the remote system to avoid seeing your input twice.
242 .PP
243 Editing operations are selected from a menu on button 2.
244 The
245 .B cut
246 operation deletes the selected text
247 from the screen and puts it in the snarf buffer;
248 .B snarf
249 copies the selected text to the buffer without deleting it;
250 .B paste
251 replaces the selected text with the contents of the buffer;
252 and
253 .B send
254 copies the snarf buffer to just after the output point, adding a final newline
255 if missing.
256 .B Paste
257 will sometimes and
258 .B send
259 will always place text after the output point; the text so placed
260 will behave exactly as described above. Therefore when pasting
261 text containing newlines after the output point, it may be prudent
262 to turn on hold mode first.
263 .PP
264 The
265 .B plumb
266 menu item sends the contents of the selection (not the snarf buffer) to the
267 .I plumber
268 (see
269 .IR plumb (1)).
270 If the selection is empty, it sends the white-space-delimited text
271 containing the selection (typing cursor).
272 A typical use of this feature is to tell the editor to find the source of an error
273 by plumbing the file and line information in a compiler's diagnostic.
274 .PP
275 Each
276 .I 9term
277 listens for connections on a Unix socket.
278 When a client connects, the
279 .I 9term
280 writes the window contents to the client and then hangs up.
281 .I 9term
282 installs the name of this socket in the environment as
283 .B $text9term
284 before running
285 .IR cmd .
286 .SH SOURCE
287 .B \*9/src/cmd/9term
288 .SH BUGS
289 There should be a program to toggle the current window's hold mode.
290 .PP
291 Not a
292 .IR 9term
293 bug:
294 when running
295 .IR bash (1)
296 in
297 .RB `` "set +o emacs" ''
298 mode, its handling of interrupts is broken.
299 In response to DEL,
300 .I bash
301 processes the interrupt but then silently discards the next
302 character typed.
303 .PP
304 Unix makes everything harder.
305 .SH SEE ALSO
306 .IR wintext (1)