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, so the terminal must be set up with EOT
192 as the ``eof'' character.
193 .I 9term
194 runs
195 .IR stty (1)
196 to establish this when the terminal is created.
197 .PP
198 .I 9term
199 always treats the DEL keystroke as an interrupt request.
200 In response it sends the terminal's current interrupt character
201 (which need not be DEL).
202 .PP
203 Normally, written output to a window blocks when
204 the text reaches the end of the screen and the terminal
205 buffer fills;
206 a button 2 menu item toggles scrolling.
207 .PP
208 .I 9term
209 changes behavior according to
210 the terminal settings of the running programs.
211 Most programs run with echo enabled.
212 In this mode,
213 .I 9term
214 displays and allows editing of the input.
215 Some programs, typically those reading passwords,
216 run with echo disabled.
217 In this mode,
218 .I 9term
219 passes keystrokes through directly, without
220 echoing them or buffering until a newline character.
221 These heuristics work well in many cases, but there
222 are a few common ones where they fall short.
223 First, programs using the GNU readline library typically
224 disable terminal echo and perform echoing themselves.
225 The most common example is the shell
226 .IR bash (1).
227 Disabling the use of readline with
228 .RB `` "set +o emacs" ''
229 .RI [ sic ]
230 usually restores the desired behavior.
231 Second, remote terminal programs such as
232 .IR ssh (1)
233 typically run with echo disabled, relying on the
234 remote system to echo characters as desired.
235 Plan 9's
236 .I ssh
237 has a
238 .B -C
239 flag to disable this, leaving the terminal in ``cooked'' mode.
240 For similar situations on Unix,
241 .IR 9term 's
242 button 2 menu has an entry to toggle the forced use of
243 cooked mode, despite the terminal settings.
244 In such cases, it is useful to run
245 .RB `` "stty -echo" ''
246 on the remote system to avoid seeing your input twice.
247 .PP
248 Editing operations are selected from a menu on button 2.
249 The
250 .B cut
251 operation deletes the selected text
252 from the screen and puts it in the snarf buffer;
253 .B snarf
254 copies the selected text to the buffer without deleting it;
255 .B paste
256 replaces the selected text with the contents of the buffer;
257 and
258 .B send
259 copies the snarf buffer to just after the output point, adding a final newline
260 if missing.
261 .B Paste
262 will sometimes and
263 .B send
264 will always place text after the output point; the text so placed
265 will behave exactly as described above. Therefore when pasting
266 text containing newlines after the output point, it may be prudent
267 to turn on hold mode first.
268 .PP
269 The
270 .B plumb
271 menu item sends the contents of the selection (not the snarf buffer) to the
272 .I plumber
273 (see
274 .IR plumb (1)).
275 If the selection is empty, it sends the white-space-delimited text
276 containing the selection (typing cursor).
277 A typical use of this feature is to tell the editor to find the source of an error
278 by plumbing the file and line information in a compiler's diagnostic.
279 .PP
280 Each
281 .I 9term
282 listens for connections on a Unix socket.
283 When a client connects, the
284 .I 9term
285 writes the window contents to the client and then hangs up.
286 .I 9term
287 installs the name of this socket in the environment as
288 .B $text9term
289 before running
290 .IR cmd .
291 .SH SOURCE
292 .B \*9/src/cmd/9term
293 .SH BUGS
294 There should be a program to toggle the current window's hold mode.
295 .PP
296 Not a
297 .IR 9term
298 bug:
299 when running
300 .IR bash (1)
301 in
302 .RB `` "set +o emacs" ''
303 mode, its handling of interrupts is broken.
304 In response to DEL,
305 .I bash
306 processes the interrupt but then silently discards the next
307 character typed.
308 .PP
309 Unix makes everything harder.
310 .SH SEE ALSO
311 .IR wintext (1)