--- a/TerminalView.st Thu Jun 24 11:37:07 1999 +0200
+++ b/TerminalView.st Thu Jun 24 11:56:09 1999 +0200
@@ -645,12 +645,22 @@
!
doClearDisplay
+ "clear everything"
+
self doClearEntireScreen.
"Modified: / 21.7.1998 / 20:05:35 / cg"
!
+doClearEntireLine
+ "clear the cursor line. cursor position remains unchanged"
+
+ self at:cursorLine put:''
+!
+
doClearEntireScreen
+ "clear everything"
+
firstLineShown to:(list size) do:[:l |
self at:l put:''
].
@@ -660,6 +670,8 @@
!
doClearFromBeginningOfLine
+ "clear from beginning of line to the cursorPosition"
+
|l|
l := self listAt:cursorLine.
@@ -679,6 +691,8 @@
!
doClearFromBeginningOfScreen
+ "clear from beginning of the screen to the cursorPosition"
+
self doClearFromBeginningOfLine.
cursorLine-1 to:firstLineShown do:[:l |
self at:l put:''
@@ -689,6 +703,8 @@
!
doClearToEndOfLine
+ "clear from the cursorPosition to the end of the line"
+
|l|
l := self listAt:cursorLine.
@@ -706,6 +722,8 @@
!
doClearToEndOfScreen
+ "clear from the cursorPosition to the end of the screen"
+
self doClearToEndOfLine.
cursorLine+1 to:(list size) do:[:l |
self at:l put:''
@@ -716,6 +734,8 @@
!
doCursorDown:n
+ "move the cursor down by n lines"
+
|wasOn rEnd|
"/ rangeEndLine == numberOfLines ifTrue:[
@@ -742,6 +762,8 @@
!
doCursorHome
+ "move the cursor to the home position"
+
self cursorVisibleLine:1 col:1
"/ super cursorHome
@@ -749,6 +771,8 @@
!
doCursorLeft:n
+ "move the cursor to the left by n columns"
+
n timesRepeat:[
super cursorLeft
]
@@ -757,22 +781,30 @@
!
doCursorNewLine
+ "move the cursor down to the next line (col remains unchanged)"
+
super cursorDown:1
"Modified: / 10.6.1998 / 16:55:57 / cg"
!
doCursorReturn
+ "move the cursor down and left to the beginning to the next line"
+
super cursorToBeginOfLine
!
doCursorRight:n
+ "move the cursor to the right by n columns"
+
self cursorCol:(cursorCol + n)
"Created: / 10.6.1998 / 15:10:08 / cg"
!
doCursorUp:n
+ "move the cursor up by n lines"
+
|wasOn rStart|
"/ rangeStartLine == 1 ifTrue:[
@@ -996,6 +1028,8 @@
!TerminalView methodsFor:'initialize / release'!
closeDownShell
+ "shut down my shell process and stop the background reader thread."
+
|pid|
(pid := shellPid) notNil ifTrue:[
@@ -1029,6 +1063,8 @@
!
destroy
+ "destroy myself - shut down the shell, stop the reader thread."
+
self closeDownShell.
self flushInput.
super destroy
@@ -1037,6 +1073,8 @@
!
escapeSequences:codes
+ "setup my escape sequences"
+
|tree|
tree isNil ifTrue:[tree := escapeSequenceTree := IdentityDictionary new].
@@ -1263,6 +1301,8 @@
!
stopReaderProcess
+ "stop the background reader thread"
+
|sensor|
readerProcess notNil ifTrue:[
@@ -1293,6 +1333,8 @@
!
doSendInterrupt
+ "send an INT-signal to the shell (UNIX only)"
+
OperatingSystem sendSignal:(OperatingSystem sigINT) to:shellPid negated.
"Modified: / 10.6.1998 / 17:49:49 / cg"
@@ -1381,6 +1423,22 @@
!TerminalView methodsFor:'processing - input'!
+doNothing
+ "private - end of an ignored escape-sequence"
+
+ self endOfSequence
+
+ "Created: / 12.6.1998 / 20:40:43 / cg"
+!
+
+endOfSequence
+ "private - reset state-machine at end of escape-sequence"
+
+ state := 0.
+
+ "Created: / 12.6.1998 / 20:39:52 / cg"
+!
+
nextPutAll:aString
"/ self processInput:aString n:aString size
self pushEvent:#processInput:n: with:aString with:aString size.
@@ -1578,6 +1636,9 @@
!TerminalView methodsFor:'queries'!
preferredExtent
+ "return my preferred extent - this is computed from my numberOfLines,
+ numberOfCols and font size"
+
^ (fontWidth * self class defaultNumberOfColumns + (leftMargin * 2))
@
((self heightForLines:self class defaultNumberOfLines) + 8)
@@ -1586,6 +1647,10 @@
!
terminalType
+ "returns a string describing this terminal (usually, this is
+ passed down to the shell as TERM environment variable).
+ Here, 'dump' is returned."
+
^ 'dump'
"Created: / 10.6.1998 / 16:22:30 / cg"
@@ -1632,5 +1697,5 @@
!TerminalView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.86 1999-06-24 09:34:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.87 1999-06-24 09:55:56 cg Exp $'
! !
--- a/VT100TerminalView.st Thu Jun 24 11:37:07 1999 +0200
+++ b/VT100TerminalView.st Thu Jun 24 11:56:09 1999 +0200
@@ -62,6 +62,8 @@
!VT100TerminalView methodsFor:'defaults'!
vt100KeyCodes
+ "return a vt100 keyCode table"
+
^ IdentityDictionary withKeysAndValues:
#(
#CursorUp '\e[A'
@@ -93,19 +95,19 @@
!VT100TerminalView methodsFor:'functions'!
addLines
- "Add the appropriate number of blank lines at the position
- indicated by the cursor."
+ "Add the appropriate number of blank lines (param 1)
+ at the cursor position."
- self addLines: ((parameters at: 1) max: 1).
+ self addLines:((parameters at:1) max:1).
self endOfSequence
"Created: / 10.6.1998 / 14:48:03 / cg"
!
-addLines: aNumber
+addLines:aNumber
"Add aNumber blank lines at the position indicated by the cursor."
- aNumber timesRepeat: [
+ aNumber timesRepeat:[
self insertLine:'' before:cursorLine
]
@@ -119,11 +121,15 @@
!
clearLines
- "Clear some part of the current line, as indicated by the first parameter."
+ "Clear some part of the current line, as indicated by the first parameter:
+ 0 - clear to EOL
+ 1 - clear from beginning to cursorCol
+ 2 - clear entire line
+ "
|arg|
- arg := parameters at: 1.
+ arg := parameters at:1.
arg = 0 ifTrue: [^self doClearToEndOfLine].
arg = 1 ifTrue: [^self doClearFromBeginningOfLine].
@@ -134,8 +140,8 @@
!
deleteCharacters
- "Delete the appropriate number of characters at the position
- indicated by the cursor."
+ "Delete the appropriate number of characters (param 1)
+ at the cursor position."
|n|
@@ -146,8 +152,8 @@
"Modified: / 12.6.1998 / 21:19:15 / cg"
!
-displayMode: anInteger
- "Set the current display mode."
+displayMode:anInteger
+ "Set the current display mode (emphasis) as specified by param 1."
|p1|
@@ -194,7 +200,11 @@
!
doClearDisplay
- "Clear some part of the current screen, as indicated by the first parameter."
+ "Clear some part of the current screen, as indicated by the first parameter.
+ 0 - clear to endOfScreen
+ 1 - clear from beginning of screen to cursorCol
+ 2 - clear entire screen
+ "
|arg|
@@ -209,13 +219,12 @@
!
insertCharacters
- "Insert the appropriate number of spaces at the position
- indicated by the cursor."
+ "Insert the appropriate number of spaces (param 1) at the cursor position."
|s|
s := String new:((parameters at: 1) max: 1).
- self insertStringWithoutCRsAtLine:cursorLine col:cursorCol.
+ self insertStringWithoutCRs:s atLine:cursorLine col:cursorCol.
"Modified: / 12.6.1998 / 21:14:25 / cg"
"Created: / 28.7.1998 / 00:53:51 / cg"
@@ -247,6 +256,8 @@
!
reportTerminalType
+ "currently, only cursor position is supported (param 6)"
+
(parameters at: 1) == 6 ifTrue:[
"/ report position
self endEntry.
@@ -307,6 +318,8 @@
!
initializeKeyboardSequences
+ "setup my keyboard sequences for a vt100"
+
kbdSequences := (self vt100KeyCodes)
"Modified: / 9.6.1998 / 20:49:21 / cg"
@@ -326,13 +339,9 @@
"Created: / 10.6.1998 / 14:39:00 / cg"
!
-doNothing
- self endOfSequence
+endOfSequence
+ "private - reset state-machine at end of escape-sequence"
- "Created: / 10.6.1998 / 14:31:56 / cg"
-!
-
-endOfSequence
state := 0.
currentParam := 1.
parameters := Array new:8 withAll:0.
@@ -627,6 +636,10 @@
!VT100TerminalView methodsFor:'queries'!
terminalType
+ "returns a string describing this terminal (usually, this is
+ passed down to the shell as TERM environment variable).
+ Here, 'vt100' is returned."
+
^ 'vt100'
"Created: / 10.6.1998 / 16:22:39 / cg"
@@ -636,5 +649,5 @@
!VT100TerminalView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.30 1999-06-24 09:37:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.31 1999-06-24 09:56:03 cg Exp $'
! !
--- a/VT52TerminalView.st Thu Jun 24 11:37:07 1999 +0200
+++ b/VT52TerminalView.st Thu Jun 24 11:56:09 1999 +0200
@@ -60,6 +60,8 @@
!VT52TerminalView methodsFor:'defaults'!
vt52KeyCodes
+ "return a vt52 keyCode table"
+
^ IdentityDictionary withKeysAndValues:
#(
#CursorUp '\eA'
@@ -97,6 +99,8 @@
!
initializeKeyboardSequences
+ "setup my keyboard sequences for a vt52"
+
kbdSequences := (self vt52KeyCodes)
@@ -104,18 +108,6 @@
!VT52TerminalView methodsFor:'processing - input'!
-doNothing
- self endOfSequence
-
- "Created: / 12.6.1998 / 20:40:43 / cg"
-!
-
-endOfSequence
- state := 0.
-
- "Created: / 12.6.1998 / 20:39:52 / cg"
-!
-
nextPut:char
"process a character (i.e. the shells output)"
@@ -244,6 +236,10 @@
!VT52TerminalView methodsFor:'queries'!
terminalType
+ "returns a string describing this terminal (usually, this is
+ passed down to the shell as TERM environment variable).
+ Here, 'vt52' is returned."
+
^ 'vt52'
"Created: / 10.6.1998 / 16:22:46 / cg"
@@ -253,5 +249,5 @@
!VT52TerminalView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/VT52TerminalView.st,v 1.15 1999-06-24 09:36:12 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/VT52TerminalView.st,v 1.16 1999-06-24 09:56:09 cg Exp $'
! !