TerminalView.st
changeset 4604 1ac8aff09094
parent 4603 e6736a82809f
child 4612 e05d68f2d152
--- a/TerminalView.st	Mon Jun 02 15:20:36 2014 +0200
+++ b/TerminalView.st	Tue Jun 03 09:55:24 2014 +0200
@@ -17,11 +17,11 @@
 		numberOfColumns numberOfLines shellTerminateAction rangeStartLine
 		rangeEndLine state savedCursor shellCommand shellDirectory
 		filterStream recorderStream localEcho translateNLToCRNL
-		inputTranslateCRToNL inputTranslateBackspaceToDelete autoWrapFlag
-		masterWindow alternateKeypadMode noColors
-		sizeOfOutstandingInputToBeProcessed lineEditMode lineBuffer
-		lineBufferCursorPosition lineBufferHistory
-		lineBufferHistoryPosition maxHistorySize'
+		inputTranslateCRToNL inputTranslateCRToCRNL
+		inputTranslateBackspaceToDelete autoWrapFlag masterWindow
+		alternateKeypadMode noColors sizeOfOutstandingInputToBeProcessed
+		lineEditMode lineBuffer lineBufferCursorPosition
+		lineBufferHistory lineBufferHistoryPosition maxHistorySize'
 	classVariableNames:'Debug DebugKeyboard DefaultMaxHistorySize'
 	poolDictionaries:''
 	category:'Views-TerminalViews'
@@ -861,15 +861,8 @@
         "/ or remove from the textview and let the program redraw them.
         "/ the second alternative looks easier for now...
         clearLine value.
-
-        lineBuffer do:[:ch |
-            self sendCharacter:ch.
-        ].
-        inputTranslateCRToNL ifTrue:[
-            self sendCharacter:(Character nl).
-        ] ifFalse:[
-            self sendCharacter:(Character return).
-        ].
+        self sendCR:lineBuffer.
+
         lineBufferHistory isNil ifTrue:[
             lineBufferHistory := OrderedCollection new.
         ].
@@ -1318,10 +1311,11 @@
     trimBlankLines := true.
     localEcho := false.
     inputTranslateCRToNL := false.
+    inputTranslateCRToCRNL := OperatingSystem isMSWINDOWSlike.
     inputTranslateBackspaceToDelete := false.
     autoWrapFlag := true.
     noColors := false.
-    lineEditMode := false.
+    lineEditMode := OperatingSystem isMSWINDOWSlike.
     maxHistorySize := maxHistorySize ? DefaultMaxHistorySize.
 
     "/ cursorType := #block.
@@ -1821,55 +1815,6 @@
 
 removeTrailingBlankLines
     ^ self
-!
-
-send:aString
-    "send aString to the underlying program's stdinput"
-
-    aString notEmptyOrNil ifTrue:[
-        recorderStream notNil ifTrue:[
-            recorderStream nextPutAll:aString
-        ].
-        Debug == true ifTrue:[
-            Transcript showCR:'send <',aString,'>'
-        ].
-        inStream nextPutAll:aString
-    ].
-
-    "Created: / 29-07-2013 / 18:18:24 / cg"
-!
-
-sendCR:aString
-    "send aString followed by a return to the underlying program's stdinput"
-
-    self send:aString.
-    inputTranslateCRToNL ifTrue:[
-        self send:(String lf)
-    ] ifFalse:[
-        self send:(String cr)
-    ]
-
-    "Created: / 29-07-2013 / 18:20:15 / cg"
-!
-
-sendCharacter:aCharacter
-    "send a single character to the underlying program's stdinput"
-
-    aCharacter bitsPerCharacter > 8 ifTrue:[
-        Transcript showCR:(self class name,': invalid (non-8bit) character ignored').
-        ^ self
-    ].
-
-    recorderStream notNil ifTrue:[
-        recorderStream nextPut:aCharacter
-    ].
-    Debug == true ifTrue:[
-        Transcript showCR:'send <',aCharacter,'>'
-    ].
-
-    inStream nextPut:aCharacter.
-
-    "Created: / 29-07-2013 / 18:18:24 / cg"
 ! !
 
 !TerminalView methodsFor:'processing-input'!
@@ -2135,23 +2080,6 @@
     "Modified: / 30-07-2013 / 10:47:19 / cg"
 !
 
-sendLine:aString
-    Debug ifTrue:[
-        'VT100: sendline: ' print. aString asByteArray hexPrintString printCR
-    ].
-
-    self send:aString.
-    self sendLineEnd
-!
-
-sendLineEnd
-    OperatingSystem isMSDOSlike ifTrue:[
-        self send:String crlf.
-    ] ifFalse:[
-        self send:String cr.
-    ].
-!
-
 sync
     self waitForOutputToDrain
 
@@ -2462,14 +2390,86 @@
     ^ StringCollection with:(sel asStringWith:'').
 ! !
 
+!TerminalView methodsFor:'sending'!
+
+send:aString
+    "send aString to the underlying program's stdinput"
+
+    aString notEmptyOrNil ifTrue:[
+        recorderStream notNil ifTrue:[
+            recorderStream nextPutAll:aString
+        ].
+        Debug == true ifTrue:[
+            Transcript showCR:'send <',aString,'>'
+        ].
+        inStream nextPutAll:aString
+    ].
+
+    "Created: / 29-07-2013 / 18:18:24 / cg"
+!
+
+sendCR:aString
+    "send aString followed by a return to the underlying program's stdinput"
+
+    self send:aString.
+    inputTranslateCRToNL ifTrue:[
+        self sendCharacter:(Character nl).
+    ] ifFalse:[
+        inputTranslateCRToCRNL ifTrue:[
+            self send:(String crlf).
+        ] ifFalse:[
+            self sendCharacter:(Character return).
+        ]
+    ]
+
+    "Created: / 29-07-2013 / 18:20:15 / cg"
+!
+
+sendCharacter:aCharacter
+    "send a single character to the underlying program's stdinput"
+
+    aCharacter bitsPerCharacter > 8 ifTrue:[
+        Transcript showCR:(self class name,': invalid (non-8bit) character ignored').
+        ^ self
+    ].
+
+    recorderStream notNil ifTrue:[
+        recorderStream nextPut:aCharacter
+    ].
+    Debug == true ifTrue:[
+        Transcript showCR:'send <',aCharacter,'>'
+    ].
+
+    inStream nextPut:aCharacter.
+
+    "Created: / 29-07-2013 / 18:18:24 / cg"
+!
+
+sendLine:aString
+    Debug ifTrue:[
+        'VT100: sendline: ' print. aString asByteArray hexPrintString printCR
+    ].
+
+    self send:aString.
+    self sendLineEnd
+!
+
+sendLineEnd
+    OperatingSystem isMSDOSlike ifTrue:[
+        self send:String crlf.
+    ] ifFalse:[
+        self send:String cr.
+    ].
+! !
+
 !TerminalView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.186 2014-06-02 13:20:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.187 2014-06-03 07:55:24 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.186 2014-06-02 13:20:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.187 2014-06-03 07:55:24 cg Exp $'
 ! !