equal
deleted
inserted
replaced
201 ^ self |
201 ^ self |
202 ]. |
202 ]. |
203 ] |
203 ] |
204 ]. |
204 ]. |
205 |
205 |
206 Transcript show:'ignored: '; showCR:rawKey. |
206 (rawKey startsWith:'Control') ifTrue:[ |
|
207 ^ self |
|
208 ]. |
|
209 (rawKey startsWith:'Shift') ifTrue:[ |
|
210 ^ self |
|
211 ]. |
|
212 (rawKey startsWith:'Alt') ifTrue:[ |
|
213 ^ self |
|
214 ]. |
|
215 (rawKey startsWith:'Cmd') ifTrue:[ |
|
216 ^ self |
|
217 ]. |
|
218 |
|
219 Transcript show:'unhandled: '; showCR:rawKey. |
207 |
220 |
208 "/ super keyPress:aKey x:x y:y |
221 "/ super keyPress:aKey x:x y:y |
209 |
222 |
210 "Modified: / 10.6.1998 / 17:12:55 / cg" |
223 "Modified: / 10.6.1998 / 17:51:21 / cg" |
211 ! |
224 ! |
212 |
225 |
213 shellTerminated |
226 shellTerminated |
214 self warn:'shell terminated'. |
227 self warn:'shell terminated'. |
215 self closeDownShell. |
228 self closeDownShell. |
302 ! |
315 ! |
303 |
316 |
304 doSendInterrupt |
317 doSendInterrupt |
305 OperatingSystem sendSignal:(OperatingSystem sigINT) to:shellPid negated. |
318 OperatingSystem sendSignal:(OperatingSystem sigINT) to:shellPid negated. |
306 |
319 |
307 "Modified: / 10.6.1998 / 15:22:22 / cg" |
320 "Modified: / 10.6.1998 / 17:49:49 / cg" |
308 ! ! |
321 ! ! |
309 |
322 |
310 !TerminalView methodsFor:'initialization'! |
323 !TerminalView methodsFor:'initialization'! |
311 |
324 |
312 closeDownShell |
325 closeDownShell |
313 |pid| |
326 |pid| |
314 |
327 |
315 (pid := shellPid) notNil ifTrue:[ |
328 (pid := shellPid) notNil ifTrue:[ |
316 Transcript print:'killing shell pid='; showCR:pid. |
329 "/ Transcript print:'killing shell pid='; showCR:pid. |
|
330 |
317 OperatingSystem terminateProcessGroup:pid. |
331 OperatingSystem terminateProcessGroup:pid. |
318 OperatingSystem terminateProcess:pid. |
332 OperatingSystem terminateProcess:pid. |
319 Delay waitForSeconds:1. |
333 Delay waitForSeconds:1. |
320 shellPid notNil ifTrue:[ |
334 shellPid notNil ifTrue:[ |
321 OperatingSystem killProcessGroup:pid. |
335 OperatingSystem killProcessGroup:pid. |
336 outStream notNil ifTrue:[ |
350 outStream notNil ifTrue:[ |
337 outStream close. |
351 outStream close. |
338 outStream := nil |
352 outStream := nil |
339 ]. |
353 ]. |
340 |
354 |
341 "Modified: / 10.6.1998 / 12:08:25 / cg" |
355 "Modified: / 10.6.1998 / 17:53:49 / cg" |
342 ! |
356 ! |
343 |
357 |
344 destroy |
358 destroy |
345 self closeDownShell. |
359 self closeDownShell. |
346 super destroy |
360 super destroy |
433 initializeKeyboardSequences |
447 initializeKeyboardSequences |
434 self subclassResponsibility. |
448 self subclassResponsibility. |
435 ! |
449 ! |
436 |
450 |
437 keyboardMap |
451 keyboardMap |
|
452 "return my keyboard map. This has control keys removed and |
|
453 those will be passed unchanged to the shell" |
|
454 |
438 ^ kbdMap |
455 ^ kbdMap |
|
456 |
|
457 "Modified: / 10.6.1998 / 17:46:59 / cg" |
439 ! |
458 ! |
440 |
459 |
441 startReaderProcess |
460 startReaderProcess |
|
461 "Start a reader process, which looks for the commands output, |
|
462 and sends me #peocessInput:n: events whenever something arrives." |
|
463 |
442 readerProcess isNil ifTrue:[ |
464 readerProcess isNil ifTrue:[ |
443 readerProcess := [ |
465 readerProcess := [ |
444 [ |
466 [ |
445 |buffer n reading| |
467 |buffer n reading| |
446 |
468 |
454 buffer := String new:1024. |
476 buffer := String new:1024. |
455 n := outStream nextAvailableBytes:1024 into:buffer startingAt:1. |
477 n := outStream nextAvailableBytes:1024 into:buffer startingAt:1. |
456 |
478 |
457 n > 0 ifTrue:[ |
479 n > 0 ifTrue:[ |
458 self pushEvent:#processInput:n: with:buffer with:n. |
480 self pushEvent:#processInput:n: with:buffer with:n. |
459 "/ self nextPutAll:(buffer copyTo:n). |
|
460 ] ifFalse:[ |
481 ] ifFalse:[ |
461 n == 0 ifTrue:[ |
482 n == 0 ifTrue:[ |
462 outStream atEnd ifTrue:[ |
483 outStream atEnd ifTrue:[ |
463 outStream close. outStream := nil. |
484 outStream close. outStream := nil. |
464 inStream close. inStream := nil. |
485 inStream close. inStream := nil. |
475 ] |
496 ] |
476 ] fork. |
497 ] fork. |
477 ] |
498 ] |
478 |
499 |
479 " |
500 " |
480 VT52TerminalView openShell |
501 VT100TerminalView openShell |
481 " |
502 " |
482 |
503 |
483 "Modified: / 10.6.1998 / 17:30:51 / cg" |
504 "Modified: / 10.6.1998 / 17:46:23 / cg" |
484 ! |
505 ! |
485 |
506 |
486 startShell |
507 startShell |
|
508 "start a shell on a pseudo terminal. |
|
509 Also fork a reader process, to read the shells output and |
|
510 pass it back to me." |
|
511 |
487 |p slaveFD execFdArray blocked exitStatus| |
512 |p slaveFD execFdArray blocked exitStatus| |
488 |
513 |
489 p := ExternalStream makePTYPair. |
514 p := ExternalStream makePTYPair. |
490 p isNil ifTrue:[ |
515 p isNil ifTrue:[ |
491 self warn:'cannot open pty'. |
516 self warn:'cannot open pty'. |
544 ]. |
569 ]. |
545 |
570 |
546 self startReaderProcess. |
571 self startReaderProcess. |
547 |
572 |
548 " |
573 " |
549 VT52TerminalView openShell |
574 VT100TerminalView openShell |
550 " |
575 " |
551 |
576 |
552 "Modified: / 10.6.1998 / 16:22:59 / cg" |
577 "Modified: / 10.6.1998 / 17:46:28 / cg" |
553 ! ! |
578 ! ! |
554 |
579 |
555 !TerminalView methodsFor:'menu'! |
580 !TerminalView methodsFor:'menu'! |
556 |
581 |
557 editMenu |
582 editMenu |
594 ^ self |
619 ^ self |
595 ! ! |
620 ! ! |
596 |
621 |
597 !TerminalView methodsFor:'processing - input'! |
622 !TerminalView methodsFor:'processing - input'! |
598 |
623 |
599 basicNextPut:aCharacter |
|
600 super nextPut:aCharacter |
|
601 ! |
|
602 |
|
603 nextPutAll:aCollection |
|
604 |l idx idx2 wasOn| |
|
605 |
|
606 wasOn := self hideCursor. |
|
607 |
|
608 l := aCollection size. |
|
609 idx := 1. |
|
610 [idx <= l] whileTrue:[ |
|
611 self nextPut:(aCollection at:idx). |
|
612 idx := idx + 1. |
|
613 ]. |
|
614 |
|
615 self makeCursorVisibleAndShowCursor:wasOn. |
|
616 self endEntry. |
|
617 |
|
618 "Modified: / 10.6.1998 / 17:13:41 / cg" |
|
619 ! |
|
620 |
|
621 processInput:buffer n:count |
624 processInput:buffer n:count |
622 1 to:count do:[:i | |
625 1 to:count do:[:i | |
623 self nextPut:(buffer at:i). |
626 self nextPut:(buffer at:i). |
624 ]. |
627 ]. |
625 (self sensor hasEvent:#processInput:n: for:self) ifFalse:[ |
628 (self sensor hasEvent:#processInput:n: for:self) ifFalse:[ |
658 ! ! |
661 ! ! |
659 |
662 |
660 !TerminalView class methodsFor:'documentation'! |
663 !TerminalView class methodsFor:'documentation'! |
661 |
664 |
662 version |
665 version |
663 ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.16 1998-06-10 15:37:08 cg Exp $' |
666 ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.17 1998-06-10 16:23:59 cg Exp $' |
664 ! ! |
667 ! ! |