Blob


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