public access to filterStream;
authorMichael Beyl <mb@exept.de>
Mon, 28 Jan 2002 21:08:59 +0100
changeset 2076 60558bc12d09
parent 2075 ac7da2b56ba6
child 2077 07bd67026b81
public access to filterStream; translateNLToCRNL flag added
TerminalView.st
VT100TerminalView.st
--- a/TerminalView.st	Mon Jan 28 10:49:17 2002 +0100
+++ b/TerminalView.st	Mon Jan 28 21:08:59 2002 +0100
@@ -18,7 +18,7 @@
 		escapeSequenceTree currentSequence kbdMap escapeLeadingChars
 		numberOfColumns numberOfLines shellTerminateAction rangeStartLine
 		rangeEndLine state savedCursor shellCommand shellDirectory
-		filterStream localEcho'
+		filterStream localEcho translateNLToCRNL'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-TerminalViews'
@@ -278,6 +278,17 @@
 
 !TerminalView methodsFor:'accessing'!
 
+filterStream:something
+    "set a filter stream; if not nil, it gets all incoming data via nextPutAll:.
+     (added to allow saving incoming data to a file, but can also be used to catch/filter/lookAt
+      incoming data by some other program)"
+
+    filterStream := something.
+
+    "Created: / 28.1.2002 / 20:56:04 / micha"
+    "Modified: / 28.1.2002 / 20:56:11 / micha"
+!
+
 inStream
     "return the value of the instance variable 'inStream' (automatically generated)"
 
@@ -323,6 +334,22 @@
     shellTerminateAction := aBlock.
 
     "Created: / 12.6.1998 / 17:02:58 / cg"
+!
+
+translateNLToCRNL
+    "return the value of the instance variable 'translateNLToCRNL' (automatically generated)"
+
+    ^ translateNLToCRNL
+
+    "Created: / 28.1.2002 / 20:32:10 / micha"
+!
+
+translateNLToCRNL:something
+    "set the value of the instance variable 'translateNLToCRNL' (automatically generated)"
+
+    translateNLToCRNL := something.
+
+    "Created: / 28.1.2002 / 20:32:10 / micha"
 ! !
 
 !TerminalView methodsFor:'cursor handling'!
@@ -1249,6 +1276,7 @@
                 Stream streamErrorSignal handle:[:ex |
                     Transcript show:'Terminal [error]: '; showCR:ex errorString.
                     Transcript show:'Terminal [info]: '; showCR:OperatingSystem lastErrorString.
+self halt.
                 ] do:[
                     [true] whileTrue:[
                         Object abortSignal handle:[:ex |
@@ -1307,6 +1335,7 @@
     "
 
     "Modified: / 5.5.1999 / 17:58:02 / cg"
+    "Modified: / 28.1.2002 / 19:18:57 / micha"
 !
 
 stopReaderProcess
@@ -1591,6 +1620,7 @@
 
     "Created: / 10.6.1998 / 17:26:09 / cg"
     "Modified: / 29.4.1999 / 11:08:48 / cg"
+    "Modified: / 28.1.2002 / 20:41:36 / micha"
 !
 
 readAnyAvailableData
@@ -1611,6 +1641,7 @@
         n := outStream nextAvailableBytes:bufferSize into:buffer startingAt:1.
     ].
     n > 0 ifTrue:[
+Transcript showCR:'read ' , n printString , ' bytes'.
         self pushEvent:#processInput:n: with:buffer with:n.
     ].
 
@@ -1618,6 +1649,7 @@
 
     "Created: / 5.5.1999 / 17:57:39 / cg"
     "Modified: / 8.5.1999 / 20:14:14 / cg"
+    "Modified: / 28.1.2002 / 19:00:56 / micha"
 !
 
 sync
@@ -1706,5 +1738,5 @@
 !TerminalView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.90 2002-01-28 09:49:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.91 2002-01-28 20:08:59 mb Exp $'
 ! !
--- a/VT100TerminalView.st	Mon Jan 28 10:49:17 2002 +0100
+++ b/VT100TerminalView.st	Mon Jan 28 21:08:59 2002 +0100
@@ -12,6 +12,8 @@
 
 
 
+"{ Package: 'stx:libwidg2' }"
+
 TerminalView subclass:#VT100TerminalView
 	instanceVariableNames:'currentParam parameters lastCursorLine'
 	classVariableNames:''
@@ -377,7 +379,11 @@
                 state := #gotESC. 
                 ^ self 
             ].
-            (char == Character nl) ifTrue:[ 
+            (char == Character nl) ifTrue:[
+                translateNLToCRNL == true ifTrue:[
+                    self endEntry.
+                    self cursorToBeginOfLine.
+                ].
                 self endEntry.
                 ^ self doCursorDown:1.
             ].
@@ -631,6 +637,7 @@
     self doNothing
 
     "Modified: / 28.7.1998 / 00:18:01 / cg"
+    "Modified: / 28.1.2002 / 20:47:07 / micha"
 ! !
 
 !VT100TerminalView methodsFor:'queries'!
@@ -649,5 +656,5 @@
 !VT100TerminalView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.32 2000-02-01 17:40:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.33 2002-01-28 20:08:54 mb Exp $'
 ! !