914
|
1 |
TextCollector subclass:#TerminalView
|
|
2 |
instanceVariableNames:'inStream outStream readerProcess shellPid kbdSequences
|
|
3 |
escapeSequenceTree currentSequence currentTree kbdMap
|
926
|
4 |
escapeLeadingChars numberOfColumns numberOfLines'
|
914
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Views-TerminalViews'
|
|
8 |
!
|
|
9 |
|
|
10 |
!TerminalView class methodsFor:'documentation'!
|
|
11 |
|
|
12 |
documentation
|
|
13 |
"
|
916
|
14 |
I provide terminal functionality, by forking a command interpreter
|
|
15 |
and comunicating with it via a pty.
|
|
16 |
I am abstract - concrete terminal characteristics are defined
|
|
17 |
by concrete subclasses (see VT52TerminalView).
|
914
|
18 |
|
|
19 |
[author:]
|
|
20 |
Claus Gittinger
|
915
|
21 |
|
|
22 |
[start with:]
|
|
23 |
VT52TerminalView openShell
|
919
|
24 |
VT100TerminalView openShell
|
914
|
25 |
"
|
|
26 |
! !
|
|
27 |
|
|
28 |
!TerminalView class methodsFor:'testing'!
|
|
29 |
|
928
|
30 |
open
|
|
31 |
self openShell
|
|
32 |
|
|
33 |
"
|
|
34 |
VT100TerminalView open
|
|
35 |
"
|
|
36 |
|
|
37 |
"Modified: / 10.6.1998 / 15:06:35 / cg"
|
|
38 |
"Created: / 10.6.1998 / 15:47:25 / cg"
|
|
39 |
!
|
|
40 |
|
914
|
41 |
openDummy
|
|
42 |
|in vt52|
|
|
43 |
|
|
44 |
vt52 := self new.
|
|
45 |
in := ForwardingStream on:''.
|
|
46 |
|
|
47 |
in fwdStream:vt52.
|
|
48 |
vt52 inStream:in.
|
|
49 |
vt52 outStream:in.
|
|
50 |
vt52 open
|
|
51 |
|
|
52 |
"
|
|
53 |
self openDummy
|
|
54 |
"
|
|
55 |
!
|
|
56 |
|
|
57 |
openShell
|
|
58 |
|in top scr vt52|
|
|
59 |
|
|
60 |
top := StandardSystemView new.
|
|
61 |
scr := HVScrollableView for:self in:top.
|
917
|
62 |
scr autoHideHorizontalScrollBar:true.
|
914
|
63 |
scr origin:0.0@0.0 corner:1.0@1.0.
|
|
64 |
vt52 := scr scrolledView.
|
|
65 |
|
|
66 |
vt52 startShell.
|
917
|
67 |
|
|
68 |
top extent:(scr preferredExtent).
|
926
|
69 |
top label:'shell'.
|
914
|
70 |
top open
|
|
71 |
|
|
72 |
"
|
|
73 |
VT52TerminalView openShell
|
|
74 |
"
|
923
|
75 |
|
926
|
76 |
"Modified: / 10.6.1998 / 15:06:35 / cg"
|
914
|
77 |
! !
|
|
78 |
|
|
79 |
!TerminalView methodsFor:'accessing'!
|
|
80 |
|
|
81 |
inStream
|
|
82 |
"return the value of the instance variable 'inStream' (automatically generated)"
|
|
83 |
|
|
84 |
^ inStream!
|
|
85 |
|
|
86 |
inStream:something
|
|
87 |
"set the value of the instance variable 'inStream' (automatically generated)"
|
|
88 |
|
|
89 |
inStream := something.!
|
|
90 |
|
|
91 |
outStream
|
|
92 |
"return the value of the instance variable 'outStream' (automatically generated)"
|
|
93 |
|
|
94 |
^ outStream!
|
|
95 |
|
|
96 |
outStream:something
|
|
97 |
"set the value of the instance variable 'outStream' (automatically generated)"
|
|
98 |
|
|
99 |
outStream := something.! !
|
|
100 |
|
|
101 |
!TerminalView methodsFor:'cursor handling'!
|
|
102 |
|
|
103 |
cursorCol:col
|
|
104 |
"check of col is a valid cursor position; return a new col-nr if not.
|
|
105 |
Here, the linelength is enforced"
|
|
106 |
|
926
|
107 |
^ super cursorCol:(col min:numberOfColumns)
|
914
|
108 |
|
926
|
109 |
"Modified: / 10.6.1998 / 15:09:34 / cg"
|
914
|
110 |
!
|
|
111 |
|
|
112 |
cursorLine:l col:col
|
|
113 |
"check of col is a valid cursor position; return a new col-nr if not.
|
|
114 |
Here, the linelength is enforced"
|
|
115 |
|
926
|
116 |
^ super cursorLine:l col:(col min:numberOfColumns)
|
914
|
117 |
|
926
|
118 |
"Modified: / 10.6.1998 / 15:09:38 / cg"
|
914
|
119 |
!
|
|
120 |
|
|
121 |
validateCursorCol:col inLine:line
|
|
122 |
"check of col is a valid cursor position; return a new col-nr if not.
|
|
123 |
Here, the linelength is enforced"
|
|
124 |
|
926
|
125 |
^ col min:numberOfColumns
|
914
|
126 |
|
926
|
127 |
"Modified: / 10.6.1998 / 15:09:41 / cg"
|
914
|
128 |
! !
|
|
129 |
|
|
130 |
!TerminalView methodsFor:'event handling'!
|
|
131 |
|
|
132 |
keyPress:aKey x:x y:y
|
|
133 |
|rest rawKey seq|
|
|
134 |
|
|
135 |
inStream isNil ifTrue:[^ self].
|
|
136 |
|
|
137 |
Transcript showCR:'----'; show:'key:' ; showCR:aKey printString.
|
|
138 |
|
|
139 |
aKey isCharacter ifTrue:[
|
|
140 |
"/ send it down to inStream ...
|
|
141 |
inStream nextPut:aKey.
|
|
142 |
^ self
|
|
143 |
].
|
|
144 |
|
921
|
145 |
aKey == #Tab ifTrue:[
|
926
|
146 |
Transcript show:'->' ; showCR:Character tab storeString.
|
921
|
147 |
inStream nextPut:Character tab.
|
|
148 |
^ self
|
|
149 |
].
|
|
150 |
|
914
|
151 |
seq := kbdSequences at:aKey ifAbsent:nil.
|
|
152 |
seq notNil ifTrue:[
|
|
153 |
Transcript show:'->' ; showCR:seq storeString.
|
|
154 |
inStream nextPutAll:(seq withEscapes).
|
|
155 |
^ self
|
|
156 |
].
|
|
157 |
|
|
158 |
rawKey := device keyboardMap keyAtValue:aKey ifAbsent:aKey.
|
|
159 |
seq := kbdSequences at:rawKey ifAbsent:nil.
|
|
160 |
seq notNil ifTrue:[
|
|
161 |
Transcript show:'->' ; showCR:seq storeString.
|
|
162 |
inStream nextPutAll:(seq withEscapes).
|
|
163 |
^ self
|
|
164 |
].
|
|
165 |
|
|
166 |
(rawKey startsWith:'Ctrl') ifTrue:[
|
|
167 |
rest := rawKey copyFrom:5.
|
|
168 |
rest size == 1 ifTrue:[
|
|
169 |
rest := rest at:1.
|
|
170 |
(rest >= $a and:[rest <= $z]) ifTrue:[
|
|
171 |
Transcript show:'->' ; showCR:(Character value:(rest - $a + 1)) storeString.
|
|
172 |
inStream nextPut:(Character value:(rest - $a + 1)).
|
|
173 |
^ self
|
|
174 |
].
|
|
175 |
(rest >= $A and:[rest <= $Z]) ifTrue:[
|
|
176 |
Transcript show:'->' ; showCR:(Character value:(rest - $a + 1)) storeString.
|
|
177 |
inStream nextPut:(Character value:(rest - $A + 1)).
|
|
178 |
^ self
|
|
179 |
].
|
|
180 |
]
|
|
181 |
].
|
|
182 |
|
|
183 |
Transcript show:'ignored: '; showCR:rawKey.
|
|
184 |
|
|
185 |
"/ super keyPress:aKey x:x y:y
|
921
|
186 |
|
926
|
187 |
"Modified: / 10.6.1998 / 14:01:32 / cg"
|
914
|
188 |
!
|
|
189 |
|
|
190 |
shellTerminated
|
|
191 |
self warn:'shell terminated'.
|
|
192 |
self closeDownShell.
|
|
193 |
! !
|
|
194 |
|
|
195 |
!TerminalView methodsFor:'functions'!
|
|
196 |
|
|
197 |
doBackspace
|
|
198 |
self cursorLeft.
|
|
199 |
self replaceCharAtCursor:(Character space).
|
|
200 |
self cursorLeft.
|
|
201 |
|
|
202 |
!
|
|
203 |
|
926
|
204 |
doClearDisplay
|
|
205 |
firstLineShown to:(list size) do:[:l |
|
|
206 |
self at:l put:''
|
|
207 |
].
|
922
|
208 |
|
926
|
209 |
"Created: / 10.6.1998 / 14:43:06 / cg"
|
|
210 |
"Modified: / 10.6.1998 / 14:58:07 / cg"
|
|
211 |
!
|
|
212 |
|
|
213 |
doClearToEnd
|
|
214 |
self doClearToEndOfLine.
|
922
|
215 |
cursorLine+1 to:(list size) do:[:l |
|
|
216 |
self at:l put:''
|
|
217 |
].
|
|
218 |
|
926
|
219 |
"Modified: / 10.6.1998 / 14:45:43 / cg"
|
|
220 |
!
|
|
221 |
|
|
222 |
doClearToEndOfLine
|
|
223 |
|l|
|
|
224 |
|
|
225 |
l := self listAt:cursorLine.
|
|
226 |
(l size > (cursorCol-1)) ifTrue:[
|
|
227 |
l := l copyTo:cursorCol-1.
|
|
228 |
self at:cursorLine put:l.
|
|
229 |
]
|
|
230 |
|
|
231 |
"Created: / 10.6.1998 / 14:45:01 / cg"
|
|
232 |
"Modified: / 10.6.1998 / 15:16:05 / cg"
|
922
|
233 |
!
|
|
234 |
|
914
|
235 |
doCursorDown
|
|
236 |
super cursorDown
|
|
237 |
!
|
|
238 |
|
926
|
239 |
doCursorDown:n
|
|
240 |
n timesRepeat:[
|
|
241 |
super cursorDown
|
|
242 |
]
|
|
243 |
|
|
244 |
"Created: / 10.6.1998 / 15:15:05 / cg"
|
|
245 |
!
|
|
246 |
|
914
|
247 |
doCursorHome
|
|
248 |
super cursorHome
|
|
249 |
!
|
|
250 |
|
|
251 |
doCursorLeft
|
|
252 |
super cursorLeft
|
|
253 |
!
|
|
254 |
|
|
255 |
doCursorNewLine
|
|
256 |
super cursorDown
|
|
257 |
!
|
|
258 |
|
|
259 |
doCursorReturn
|
|
260 |
super cursorToBeginOfLine
|
|
261 |
!
|
|
262 |
|
|
263 |
doCursorRight
|
|
264 |
super cursorRight
|
|
265 |
!
|
|
266 |
|
926
|
267 |
doCursorRight:n
|
|
268 |
self cursorCol:(cursorCol + n)
|
|
269 |
|
|
270 |
"Created: / 10.6.1998 / 15:10:08 / cg"
|
|
271 |
!
|
|
272 |
|
914
|
273 |
doCursorUp
|
|
274 |
super cursorUp
|
926
|
275 |
!
|
|
276 |
|
|
277 |
doSendInterrupt
|
|
278 |
OperatingSystem sendSignal:(OperatingSystem sigINT) to:shellPid negated.
|
|
279 |
|
|
280 |
"Modified: / 10.6.1998 / 15:22:22 / cg"
|
914
|
281 |
! !
|
|
282 |
|
|
283 |
!TerminalView methodsFor:'initialization'!
|
|
284 |
|
|
285 |
closeDownShell
|
926
|
286 |
|pid|
|
|
287 |
|
|
288 |
(pid := shellPid) notNil ifTrue:[
|
|
289 |
Transcript print:'killing shell pid='; showCR:pid.
|
|
290 |
OperatingSystem terminateProcessGroup:pid.
|
|
291 |
OperatingSystem terminateProcess:pid.
|
925
|
292 |
Delay waitForSeconds:1.
|
|
293 |
shellPid notNil ifTrue:[
|
926
|
294 |
OperatingSystem killProcessGroup:pid.
|
|
295 |
OperatingSystem killProcess:pid.
|
925
|
296 |
shellPid := nil.
|
|
297 |
].
|
926
|
298 |
OperatingSystem closePid:pid.
|
914
|
299 |
].
|
|
300 |
|
|
301 |
readerProcess notNil ifTrue:[
|
|
302 |
readerProcess terminate.
|
|
303 |
readerProcess := nil
|
|
304 |
].
|
|
305 |
inStream notNil ifTrue:[
|
|
306 |
inStream close.
|
|
307 |
inStream := nil
|
|
308 |
].
|
|
309 |
outStream notNil ifTrue:[
|
|
310 |
outStream close.
|
|
311 |
outStream := nil
|
|
312 |
].
|
924
|
313 |
|
926
|
314 |
"Modified: / 10.6.1998 / 12:08:25 / cg"
|
914
|
315 |
!
|
|
316 |
|
|
317 |
destroy
|
|
318 |
self closeDownShell.
|
|
319 |
super destroy
|
|
320 |
!
|
|
321 |
|
|
322 |
escapeSequences:codes
|
|
323 |
|tree|
|
|
324 |
|
|
325 |
tree isNil ifTrue:[tree := escapeSequenceTree := IdentityDictionary new].
|
|
326 |
|
|
327 |
codes do:[:specEntry |
|
|
328 |
|sequence function|
|
|
329 |
|
|
330 |
sequence := (specEntry at:1) withEscapes.
|
|
331 |
function := specEntry at:2.
|
|
332 |
|
|
333 |
tree := escapeSequenceTree.
|
|
334 |
|
|
335 |
sequence keysAndValuesDo:[:idx :char |
|
|
336 |
|followup|
|
|
337 |
|
|
338 |
idx == sequence size ifTrue:[
|
|
339 |
tree at:char put:function
|
|
340 |
] ifFalse:[
|
|
341 |
followup := tree at:char ifAbsent:nil.
|
|
342 |
followup isNil ifTrue:[
|
|
343 |
tree at:char put:(followup := IdentityDictionary new).
|
|
344 |
].
|
|
345 |
tree := followup
|
|
346 |
]
|
|
347 |
]
|
|
348 |
].
|
918
|
349 |
escapeLeadingChars := escapeSequenceTree keys asSet.
|
|
350 |
escapeLeadingChars add:(Character cr).
|
|
351 |
escapeLeadingChars add:(Character return).
|
|
352 |
escapeLeadingChars add:(Character backspace).
|
|
353 |
|
|
354 |
escapeLeadingChars := escapeLeadingChars asArray
|
|
355 |
|
|
356 |
"Modified: / 9.6.1998 / 19:43:12 / cg"
|
914
|
357 |
!
|
|
358 |
|
|
359 |
initialize
|
|
360 |
super initialize.
|
|
361 |
|
|
362 |
showMatchingParenthesis := false.
|
|
363 |
insertMode := false.
|
|
364 |
|
926
|
365 |
numberOfColumns := 80.
|
|
366 |
numberOfLines := 25.
|
|
367 |
|
914
|
368 |
self initializeEscapeSequences.
|
|
369 |
self initializeKeyboardSequences.
|
|
370 |
list := OrderedCollection new:24 withAll:''.
|
|
371 |
|
|
372 |
self initializeKeyboardMap.
|
|
373 |
|
|
374 |
"
|
|
375 |
VT52TerminalView openShell
|
926
|
376 |
VT100TerminalView openShell
|
914
|
377 |
"
|
926
|
378 |
|
|
379 |
"Modified: / 10.6.1998 / 14:47:09 / cg"
|
914
|
380 |
!
|
|
381 |
|
|
382 |
initializeEscapeSequences
|
|
383 |
self subclassResponsibility.
|
|
384 |
!
|
|
385 |
|
|
386 |
initializeKeyboardMap
|
|
387 |
|ctrlKeys cmdKeys|
|
|
388 |
|
|
389 |
"/ setup my own keyboardMap, where control-keys are
|
|
390 |
"/ not translated.
|
|
391 |
kbdMap := device keyboardMap copy.
|
|
392 |
|
|
393 |
ctrlKeys := kbdMap keys select:[:key | key startsWith:'Ctrl'].
|
|
394 |
ctrlKeys do:[:key | kbdMap removeKey:key].
|
|
395 |
cmdKeys := kbdMap keys select:[:key | key startsWith:'Cmd'].
|
|
396 |
cmdKeys do:[:key | kbdMap removeKey:key].
|
|
397 |
|
|
398 |
kbdMap removeKey:#Delete ifAbsent:[].
|
|
399 |
kbdMap removeKey:#BackSpace ifAbsent:[].
|
|
400 |
|
|
401 |
"
|
|
402 |
VT52TerminalView openShell
|
|
403 |
"
|
|
404 |
!
|
|
405 |
|
|
406 |
initializeKeyboardSequences
|
|
407 |
self subclassResponsibility.
|
|
408 |
!
|
|
409 |
|
|
410 |
keyboardMap
|
|
411 |
^ kbdMap
|
|
412 |
!
|
|
413 |
|
|
414 |
startReaderProcess
|
|
415 |
readerProcess isNil ifTrue:[
|
|
416 |
readerProcess := [
|
|
417 |
[
|
926
|
418 |
|buffer n reading|
|
|
419 |
|
|
420 |
reading := true.
|
|
421 |
Stream errorSignal catch:[
|
|
422 |
buffer := String new:1024.
|
|
423 |
[true] whileTrue:[
|
|
424 |
Object abortSignal handle:[:ex |
|
|
425 |
self showCursor.
|
|
426 |
] do:[
|
|
427 |
outStream readWait.
|
|
428 |
n := outStream nextAvailableBytes:1024 into:buffer startingAt:1.
|
914
|
429 |
|
926
|
430 |
n > 0 ifTrue:[
|
|
431 |
self nextPutAll:(buffer copyTo:n).
|
|
432 |
] ifFalse:[
|
|
433 |
n == 0 ifTrue:[
|
|
434 |
outStream atEnd ifTrue:[
|
|
435 |
outStream close. outStream := nil.
|
|
436 |
inStream close. inStream := nil.
|
|
437 |
|
|
438 |
Processor activeProcess terminate.
|
|
439 |
]
|
|
440 |
]
|
914
|
441 |
]
|
|
442 |
]
|
|
443 |
]
|
|
444 |
]
|
|
445 |
] valueOnUnwindDo:[
|
|
446 |
readerProcess := nil
|
|
447 |
]
|
|
448 |
] fork.
|
|
449 |
]
|
|
450 |
|
|
451 |
"
|
|
452 |
VT52TerminalView openShell
|
|
453 |
"
|
926
|
454 |
|
|
455 |
"Modified: / 10.6.1998 / 15:19:09 / cg"
|
914
|
456 |
!
|
|
457 |
|
|
458 |
startShell
|
|
459 |
|p slaveFD execFdArray blocked exitStatus|
|
|
460 |
|
|
461 |
p := ExternalStream makePTYPair.
|
|
462 |
p isNil ifTrue:[
|
915
|
463 |
self warn:'cannot open pty'.
|
914
|
464 |
^ self.
|
|
465 |
].
|
|
466 |
|
|
467 |
"/ p at:1 is the master;
|
|
468 |
"/ p at:2 is the slave
|
|
469 |
inStream := outStream := (p at:1).
|
|
470 |
inStream buffered:false.
|
|
471 |
|
|
472 |
"/ fork a shell process on the slave-side
|
|
473 |
slaveFD := (p at:2) fileDescriptor.
|
|
474 |
|
|
475 |
execFdArray := Array with:slaveFD with:slaveFD with:slaveFD.
|
|
476 |
|
|
477 |
blocked := OperatingSystem blockInterrupts.
|
|
478 |
|
|
479 |
shellPid := Processor
|
|
480 |
monitor:[
|
|
481 |
OperatingSystem
|
|
482 |
exec:'/bin/sh'
|
|
483 |
withArguments:#('sh')
|
|
484 |
fileDescriptors:execFdArray
|
|
485 |
closeDescriptors:#()
|
|
486 |
fork:true
|
|
487 |
newPgrp:true
|
|
488 |
inDirectory:nil.
|
|
489 |
]
|
|
490 |
action:[:status |
|
|
491 |
Transcript show:'pid:'; showCR:status pid.
|
|
492 |
Transcript show:'status:'; showCR:status status.
|
|
493 |
Transcript show:'code:'; showCR:status code.
|
|
494 |
Transcript show:'core:'; showCR:status core.
|
|
495 |
status stillAlive ifFalse:[
|
|
496 |
exitStatus := status.
|
|
497 |
OperatingSystem closePid:shellPid.
|
|
498 |
shellPid := nil.
|
|
499 |
self pushEvent:#shellTerminated
|
|
500 |
].
|
|
501 |
].
|
|
502 |
|
|
503 |
shellPid isNil ifTrue:[
|
|
504 |
self halt.
|
|
505 |
(p at:1) close.
|
|
506 |
(p at:2) close.
|
|
507 |
].
|
|
508 |
|
|
509 |
blocked ifFalse:[
|
|
510 |
OperatingSystem unblockInterrupts
|
|
511 |
].
|
|
512 |
|
|
513 |
self startReaderProcess.
|
|
514 |
|
|
515 |
"
|
|
516 |
VT52TerminalView openShell
|
|
517 |
"
|
|
518 |
! !
|
|
519 |
|
|
520 |
!TerminalView methodsFor:'menu'!
|
|
521 |
|
|
522 |
editMenu
|
|
523 |
"return the views middleButtonMenu"
|
|
524 |
|
|
525 |
<resource: #keyboard (#Copy #Paste #Print)>
|
|
526 |
<resource: #programMenu>
|
|
527 |
|
|
528 |
|items m sub shortKeys sensor|
|
|
529 |
|
|
530 |
((sensor := self sensor) notNil and:[sensor ctrlDown]) ifTrue:[
|
|
531 |
items := #(
|
|
532 |
('Interrupt' doSendInterrupt)
|
|
533 |
).
|
|
534 |
] ifFalse:[
|
|
535 |
items := #(
|
|
536 |
('copy' copySelection Copy )
|
|
537 |
('paste' pasteOrReplace Paste )
|
|
538 |
('-' )
|
|
539 |
('save as ...' save SaveAs )
|
|
540 |
('print' doPrint Print )
|
|
541 |
).
|
|
542 |
].
|
|
543 |
|
|
544 |
m := PopUpMenu itemList:items resources:resources.
|
|
545 |
|
|
546 |
self hasSelection not ifTrue:[
|
|
547 |
m disable:#copySelection.
|
|
548 |
].
|
|
549 |
^ m.
|
|
550 |
|
|
551 |
"Modified: / 21.5.1998 / 15:52:38 / cg"
|
|
552 |
|
|
553 |
|
|
554 |
! !
|
|
555 |
|
|
556 |
!TerminalView methodsFor:'misc'!
|
|
557 |
|
|
558 |
removeTrailingBlankLines
|
|
559 |
^ self
|
|
560 |
! !
|
|
561 |
|
|
562 |
!TerminalView methodsFor:'processing - input'!
|
|
563 |
|
|
564 |
basicNextPut:aCharacter
|
|
565 |
super nextPut:aCharacter
|
|
566 |
!
|
|
567 |
|
|
568 |
nextPut:aCharacter
|
|
569 |
|where next|
|
|
570 |
|
|
571 |
"/ Transcript showCR:aCharacter asciiValue.
|
|
572 |
|
|
573 |
where := currentTree ? escapeSequenceTree.
|
|
574 |
"/ Transcript showCR:'current: ' , where storeString.
|
|
575 |
|
|
576 |
next := where at:aCharacter ifAbsent:nil.
|
|
577 |
"/ Transcript showCR:'next: ' , next storeString.
|
|
578 |
next isNil ifTrue:[
|
|
579 |
"/ something collected so far ?
|
|
580 |
currentSequence notNil ifTrue:[
|
|
581 |
self halt.
|
|
582 |
].
|
|
583 |
|
|
584 |
self replaceCharAtCursor:aCharacter.
|
|
585 |
"/ self cursorRight.
|
|
586 |
|
|
587 |
currentTree := nil.
|
|
588 |
^ self.
|
|
589 |
].
|
|
590 |
|
|
591 |
next isSymbol ifTrue:[
|
|
592 |
self perform:next.
|
|
593 |
currentTree := nil.
|
|
594 |
^ self
|
|
595 |
].
|
|
596 |
currentTree := next
|
|
597 |
!
|
|
598 |
|
|
599 |
nextPutAll:aCollection
|
918
|
600 |
|l idx idx2 wasOn|
|
|
601 |
|
|
602 |
wasOn := self hideCursor.
|
914
|
603 |
|
918
|
604 |
l := aCollection size.
|
|
605 |
idx := 1.
|
|
606 |
[idx <= l] whileTrue:[
|
919
|
607 |
"/ currentTree isNil ifTrue:[
|
|
608 |
"/ idx2 := aCollection indexOfAny:escapeLeadingChars startingAt:idx.
|
|
609 |
"/ idx2 == 0 ifTrue:[
|
|
610 |
"/ self replaceAllAtCursor:(aCollection copyFrom:idx).
|
|
611 |
"/ self makeCursorVisibleAndShowCursor:wasOn.
|
|
612 |
"/ ^ self
|
|
613 |
"/ ].
|
|
614 |
"/ self replaceAllAtCursor:(aCollection copyFrom:idx to:idx2-1).
|
|
615 |
"/ idx := idx2.
|
|
616 |
"/ ].
|
918
|
617 |
self nextPut:(aCollection at:idx).
|
|
618 |
idx := idx + 1.
|
914
|
619 |
].
|
|
620 |
|
918
|
621 |
self makeCursorVisibleAndShowCursor:wasOn.
|
|
622 |
|
919
|
623 |
"VT52TerminalView openShell"
|
|
624 |
|
|
625 |
"Modified: / 9.6.1998 / 20:46:29 / cg"
|
914
|
626 |
! !
|
|
627 |
|
|
628 |
!TerminalView methodsFor:'queries'!
|
|
629 |
|
|
630 |
preferredExtent
|
926
|
631 |
^ (fontWidth * numberOfColumns + (leftMargin * 2)) @ (self heightForLines:numberOfLines)
|
|
632 |
|
|
633 |
"Modified: / 10.6.1998 / 14:47:03 / cg"
|
914
|
634 |
! !
|
|
635 |
|
|
636 |
!TerminalView methodsFor:'selection handling'!
|
|
637 |
|
|
638 |
paste:someText
|
|
639 |
"paste - redefined to send the chars to the shell instead
|
|
640 |
of pasting into the view"
|
|
641 |
|
|
642 |
someText asString string do:[:aChar |
|
|
643 |
inStream nextPut:aChar
|
|
644 |
]
|
|
645 |
! !
|
|
646 |
|
|
647 |
!TerminalView class methodsFor:'documentation'!
|
|
648 |
|
|
649 |
version
|
928
|
650 |
^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.13 1998-06-10 13:47:42 cg Exp $'
|
914
|
651 |
! !
|