Blob


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