author | Claus Gittinger <cg@exept.de> |
Mon, 26 Apr 1999 16:43:02 +0200 | |
changeset 1340 | 494d79438431 |
parent 1287 | 48e6c847a554 |
child 1352 | b10f36808e3e |
permissions | -rw-r--r-- |
930 | 1 |
TerminalView subclass:#VT100TerminalView |
998 | 2 |
instanceVariableNames:'currentParam parameters lastCursorLine' |
920 | 3 |
classVariableNames:'' |
4 |
poolDictionaries:'' |
|
5 |
category:'Views-TerminalViews' |
|
6 |
! |
|
7 |
||
927 | 8 |
!VT100TerminalView class methodsFor:'documentation'! |
9 |
||
10 |
documentation |
|
11 |
" |
|
12 |
VT100 terminal |
|
13 |
||
14 |
[start with:] |
|
15 |
VT100TerminalView openShell |
|
16 |
" |
|
17 |
||
18 |
||
19 |
! ! |
|
920 | 20 |
|
932 | 21 |
!VT100TerminalView methodsFor:'defaults'! |
927 | 22 |
|
23 |
vt100KeyCodes |
|
24 |
^ IdentityDictionary withKeysAndValues: |
|
25 |
#( |
|
26 |
#CursorUp '\e[A' |
|
27 |
#CursorDown '\e[B' |
|
28 |
#CursorRight '\e[C' |
|
29 |
#CursorLeft '\e[D' |
|
30 |
#Home '\e[H' |
|
31 |
#Escape '\e' |
|
32 |
#BackSpace '\b' |
|
33 |
#Return '\r' |
|
976 | 34 |
#Delete '\0177' |
927 | 35 |
) |
36 |
||
37 |
"Created: / 10.6.1998 / 15:13:01 / cg" |
|
976 | 38 |
"Modified: / 20.6.1998 / 17:36:33 / cg" |
927 | 39 |
! ! |
40 |
||
41 |
!VT100TerminalView methodsFor:'functions'! |
|
42 |
||
43 |
addLines |
|
44 |
"Add the appropriate number of blank lines at the position |
|
45 |
indicated by the cursor." |
|
46 |
||
47 |
self addLines: ((parameters at: 1) max: 1). |
|
48 |
self endOfSequence |
|
49 |
||
50 |
"Created: / 10.6.1998 / 14:48:03 / cg" |
|
51 |
! |
|
52 |
||
53 |
addLines: aNumber |
|
54 |
"Add aNumber blank lines at the position indicated by the cursor." |
|
55 |
||
56 |
aNumber timesRepeat: [ |
|
57 |
self insertLine:'' before:cursorLine |
|
58 |
] |
|
59 |
||
60 |
"Created: / 10.6.1998 / 14:49:30 / cg" |
|
61 |
! |
|
62 |
||
949 | 63 |
autoMargin:aBoolean |
64 |
"set/clear autowrap at end of line (not yet implemented)" |
|
65 |
||
66 |
"Created: / 12.6.1998 / 21:42:06 / cg" |
|
67 |
! |
|
68 |
||
927 | 69 |
clearLines |
70 |
"Clear some part of the current line, as indicated by the first parameter." |
|
71 |
||
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
72 |
|arg| |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
73 |
|
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
74 |
arg := parameters at: 1. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
75 |
|
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
76 |
arg = 0 ifTrue: [^self doClearToEndOfLine]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
77 |
arg = 1 ifTrue: [^self doClearFromBeginningOfLine]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
78 |
arg = 2 ifTrue: [^self doClearEntireLine] |
927 | 79 |
|
80 |
"Created: / 10.6.1998 / 14:44:22 / cg" |
|
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
81 |
"Modified: / 21.7.1998 / 20:07:42 / cg" |
927 | 82 |
! |
83 |
||
949 | 84 |
deleteCharacters |
85 |
"Delete the appropriate number of characters at the position |
|
86 |
indicated by the cursor." |
|
87 |
||
88 |
|n| |
|
89 |
||
90 |
n := ((parameters at: 1) max: 1). |
|
91 |
self deleteFromLine:cursorLine col:cursorCol toLine:cursorLine col:cursorCol+n-1. |
|
92 |
||
93 |
"Created: / 12.6.1998 / 21:19:02 / cg" |
|
94 |
"Modified: / 12.6.1998 / 21:19:15 / cg" |
|
95 |
! |
|
96 |
||
927 | 97 |
displayMode: anInteger |
98 |
"Set the current display mode." |
|
99 |
||
1020 | 100 |
"/ self endEntry. |
951 | 101 |
(parameters at:1) == 1 ifTrue:[ |
102 |
"/ ESC-[-1-m -> bold |
|
103 |
||
1287
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
104 |
"/ workaround: windows bold fonts are |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
105 |
"/ wider, leading to ugly looking output |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
106 |
"/ Therefore, use red color instead of bold |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
107 |
Display platformName = 'WIN32' ifTrue:[ |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
108 |
self color:Color red. |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
109 |
] ifFalse:[ |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
110 |
self bold. |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
111 |
]. |
951 | 112 |
^ self. |
113 |
]. |
|
978 | 114 |
(parameters at:1) == 7 ifTrue:[ |
115 |
"/ ESC-[-7-m -> revers |
|
951 | 116 |
|
978 | 117 |
self reverse. |
118 |
^ self. |
|
119 |
]. |
|
1020 | 120 |
|
978 | 121 |
"/ ESC-[-any-m -> normal |
122 |
self normal. |
|
927 | 123 |
|
124 |
"Created: / 10.6.1998 / 15:01:16 / cg" |
|
1287
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
125 |
"Modified: / 26.3.1999 / 14:31:53 / cg" |
927 | 126 |
! |
127 |
||
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
128 |
doClearDisplay |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
129 |
"Clear some part of the current screen, as indicated by the first parameter." |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
130 |
|
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
131 |
|arg| |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
132 |
|
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
133 |
arg := parameters at: 1. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
134 |
|
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
135 |
arg = 0 ifTrue: [^self doClearToEndOfScreen]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
136 |
arg = 1 ifTrue: [^self doClearFromBeginningOfScreen]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
137 |
arg = 2 ifTrue: [^self doClearEntireScreen] |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
138 |
|
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
139 |
"Created: / 21.7.1998 / 20:05:07 / cg" |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
140 |
"Modified: / 21.7.1998 / 20:07:36 / cg" |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
141 |
! |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
142 |
|
1020 | 143 |
insertCharacters |
949 | 144 |
"Insert the appropriate number of spaces at the position |
145 |
indicated by the cursor." |
|
146 |
||
147 |
|s| |
|
148 |
||
149 |
s := String new:((parameters at: 1) max: 1). |
|
150 |
self insertStringWithoutCRsAtLine:cursorLine col:cursorCol. |
|
151 |
||
152 |
"Modified: / 12.6.1998 / 21:14:25 / cg" |
|
1020 | 153 |
"Created: / 28.7.1998 / 00:53:51 / cg" |
949 | 154 |
! |
155 |
||
927 | 156 |
move |
157 |
"Move to the locations indicated by the first and second parameters." |
|
158 |
||
159 |
self moveToX: ((parameters at: 2) max: 1) y: ((parameters at: 1) max: 1). |
|
160 |
||
161 |
"Created: / 10.6.1998 / 14:40:01 / cg" |
|
978 | 162 |
"Modified: / 20.6.1998 / 18:49:12 / cg" |
927 | 163 |
! |
164 |
||
165 |
moveToX: xLocation y: yLocation |
|
166 |
"Position the cursor at the location given by xLocation and yLocation. |
|
167 |
Ignore the command if the parameters are outside the allowable range." |
|
168 |
||
978 | 169 |
"/ Transcript show:'numberOfColumns '; showCR:numberOfColumns. |
170 |
"/ Transcript show:'numberOfLines '; showCR:numberOfLines. |
|
171 |
||
172 |
"/ (xLocation < 1 or: [xLocation > numberOfColumns]) ifTrue: [^self]. |
|
173 |
"/ (yLocation < 1 or: [yLocation > numberOfLines]) ifTrue: [^self]. |
|
952 | 174 |
|
949 | 175 |
self cursorVisibleLine:yLocation col:xLocation. |
927 | 176 |
|
177 |
"Created: / 10.6.1998 / 14:40:49 / cg" |
|
978 | 178 |
"Modified: / 20.6.1998 / 20:27:11 / cg" |
927 | 179 |
! |
180 |
||
944 | 181 |
reportTerminalType |
182 |
(parameters at: 1) == 6 ifTrue:[ |
|
183 |
"/ report position |
|
1020 | 184 |
self endEntry. |
185 |
||
944 | 186 |
inStream nextPut:(Character esc). |
187 |
inStream nextPutAll:'[' |
|
188 |
, cursorLine printString |
|
189 |
, ';' |
|
190 |
, cursorCol printString |
|
191 |
, 'R'. |
|
192 |
^ self |
|
193 |
]. |
|
194 |
(parameters at: 1) == 7 ifTrue:[ |
|
195 |
"/ display name |
|
196 |
]. |
|
197 |
||
198 |
"Created: / 11.6.1998 / 23:05:50 / cg" |
|
1020 | 199 |
"Modified: / 28.7.1998 / 00:54:30 / cg" |
944 | 200 |
! |
201 |
||
927 | 202 |
resetDefaults |
203 |
"Reset the default parameters" |
|
204 |
||
949 | 205 |
|l1 c1 l2 c2| |
206 |
||
978 | 207 |
|
949 | 208 |
l1 := (parameters at: 1). |
209 |
l2 := (parameters at: 2). |
|
978 | 210 |
"/ Transcript show:'resetDefaults:'; show:l1;show:' ';showCR:l2. |
949 | 211 |
(l1 ~~ 0 and:[l2 ~~ 0]) ifTrue:[ |
212 |
rangeStartLine := l1. |
|
213 |
rangeEndLine := l2. |
|
214 |
] ifFalse:[ |
|
978 | 215 |
"/ self halt. |
949 | 216 |
]. |
217 |
||
978 | 218 |
"/ (rangeStartLine == 1 and:[rangeEndLine == numberOfLines]) ifTrue:[ |
219 |
"/ rangeEndLine := rangeStartLine := nil. |
|
220 |
"/ ]. |
|
221 |
||
222 |
"/ autoLineFeed := false. |
|
223 |
"/ autoMargin := true. |
|
224 |
"/ displayMode := 0. "Normal display"!! !! |
|
927 | 225 |
|
226 |
"Created: / 10.6.1998 / 14:50:53 / cg" |
|
978 | 227 |
"Modified: / 20.6.1998 / 20:28:26 / cg" |
920 | 228 |
! ! |
229 |
||
230 |
!VT100TerminalView methodsFor:'initialization'! |
|
231 |
||
927 | 232 |
initialize |
233 |
super initialize. |
|
949 | 234 |
|
927 | 235 |
self endOfSequence |
236 |
||
237 |
"Created: / 10.6.1998 / 14:46:07 / cg" |
|
953 | 238 |
"Modified: / 13.6.1998 / 13:58:01 / cg" |
927 | 239 |
! |
240 |
||
241 |
initializeKeyboardSequences |
|
242 |
kbdSequences := (self vt100KeyCodes) |
|
243 |
||
244 |
"Modified: / 9.6.1998 / 20:49:21 / cg" |
|
245 |
"Created: / 10.6.1998 / 15:12:32 / cg" |
|
246 |
! ! |
|
247 |
||
248 |
!VT100TerminalView methodsFor:'processing - input'! |
|
249 |
||
250 |
addToParameter: char |
|
251 |
"The parameter char is a digit. Add it to the current parameter." |
|
252 |
||
253 |
| param | |
|
254 |
||
255 |
param := parameters at:currentParam. |
|
256 |
parameters at:currentParam put:(param * 10 + char digitValue) |
|
257 |
||
258 |
"Created: / 10.6.1998 / 14:39:00 / cg" |
|
259 |
! |
|
260 |
||
261 |
doNothing |
|
262 |
self endOfSequence |
|
263 |
||
264 |
"Created: / 10.6.1998 / 14:31:56 / cg" |
|
265 |
! |
|
266 |
||
267 |
endOfSequence |
|
268 |
state := 0. |
|
269 |
currentParam := 1. |
|
270 |
parameters := Array new:8 withAll:0. |
|
271 |
||
272 |
"Created: / 10.6.1998 / 14:30:40 / cg" |
|
273 |
"Modified: / 10.6.1998 / 14:30:57 / cg" |
|
274 |
! |
|
275 |
||
276 |
nextPut:char |
|
937 | 277 |
"process a character (i.e. the shells output)" |
278 |
||
944 | 279 |
"/ Transcript show:state; show:' '; showCR:char storeString. |
932 | 280 |
|
933
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
281 |
state == #gotReturn ifTrue:[ |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
282 |
state := 0. |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
283 |
char == Character nl ifTrue:[ |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
284 |
"/ cr-nl |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
285 |
"/ stay in buffering mode. |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
286 |
super nextPut:Character cr. |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
287 |
^ self. |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
288 |
]. |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
289 |
self endEntry. |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
290 |
self cursorToBeginOfLine. |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
291 |
"/ continue in initial state |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
292 |
]. |
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
293 |
|
927 | 294 |
state == 0 ifTrue:[ |
295 |
"/ Currently, we are in initial state. |
|
296 |
"/ Decide what to do on the basis of the parameter char. |
|
297 |
||
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
298 |
char asciiValue < 32 ifTrue:[ |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
299 |
(char == Character esc) ifTrue:[ |
1020 | 300 |
state := #gotESC. |
301 |
^ self |
|
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
302 |
]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
303 |
(char == Character nl) ifTrue:[ |
951 | 304 |
self endEntry. |
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
305 |
^ self doCursorDown:1. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
306 |
]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
307 |
(char == Character return) ifTrue:[ |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
308 |
(rangeEndLine notNil and:[rangeEndLine ~~ numberOfLines]) ifTrue:[ |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
309 |
self endEntry. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
310 |
self cursorToBeginOfLine. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
311 |
] ifFalse:[ |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
312 |
state := #gotReturn. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
313 |
]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
314 |
^ self. |
951 | 315 |
]. |
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
316 |
(char == Character backspace) ifTrue:[ |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
317 |
self endEntry. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
318 |
^ self cursorLeft. "/ doBackspace |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
319 |
]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
320 |
(char == Character bell) ifTrue:[ |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
321 |
self beep. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
322 |
^ self |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
323 |
]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
324 |
(char == (Character value:5)) ifTrue:[ |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
325 |
"/ terminal-type query |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
326 |
self reportTerminalType. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
327 |
^ self |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
328 |
]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
329 |
(char == (Character value:16rf)) ifTrue:[ |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
330 |
"/ SO |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
331 |
^ self |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
332 |
]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
333 |
(char == (Character value:16re)) ifTrue:[ |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
334 |
"/ SI |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
335 |
^ self |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
336 |
]. |
978 | 337 |
char ~~ Character tab ifTrue:[ |
338 |
char asciiValue ~~ 0 ifTrue:[ |
|
1340 | 339 |
('VT100 [info]: unhandled control key: ' , char storeString) infoPrintCR. |
978 | 340 |
]. |
341 |
^ self. |
|
342 |
] |
|
343 |
]. |
|
934 | 344 |
^ super nextPut:char |
927 | 345 |
]. |
346 |
||
944 | 347 |
state == #gotESC ifTrue:[ |
927 | 348 |
"/ Currently, we are in ESC state. |
349 |
"/ Decide what to do on the basis of the parameter char. |
|
350 |
||
351 |
char == $[ ifTrue: [ |
|
352 |
"/ ESC-[ |
|
944 | 353 |
state := #gotCSI. |
354 |
^ self |
|
355 |
]. |
|
356 |
char == $] ifTrue: [ |
|
357 |
"/ ESC-] |
|
358 |
"/xterm sequence |
|
359 |
state := #gotXTERMCSI. |
|
927 | 360 |
^ self |
361 |
]. |
|
944 | 362 |
char == $( ifTrue: [ |
363 |
"/ ESC-( |
|
364 |
"/ todo: set-charset 0 ... |
|
1056 | 365 |
state := #gotCSI3. |
366 |
^ self |
|
944 | 367 |
]. |
368 |
char == $) ifTrue: [ |
|
369 |
"/ ESC-( |
|
370 |
"/ todo: set-charset 1 ... |
|
371 |
^ self doNothing |
|
372 |
]. |
|
373 |
char == $7 ifTrue:[ |
|
374 |
"/ ESC-7 |
|
1020 | 375 |
self endEntry. |
944 | 376 |
self saveCursor. |
377 |
^ self endOfSequence |
|
378 |
]. |
|
379 |
char == $8 ifTrue:[ |
|
380 |
"/ ESC-7 |
|
1020 | 381 |
self endEntry. |
944 | 382 |
self restoreCursor. |
383 |
^ self endOfSequence |
|
384 |
]. |
|
927 | 385 |
char == $M ifTrue:[ |
386 |
"/ ESC-M |
|
1020 | 387 |
self endEntry. |
951 | 388 |
self doCursorUp:1. |
927 | 389 |
^ self endOfSequence |
390 |
]. |
|
391 |
char == $D ifTrue:[ |
|
392 |
"/ ESC-D |
|
1020 | 393 |
self endEntry. |
951 | 394 |
self doCursorDown:1. |
927 | 395 |
^ self endOfSequence |
396 |
]. |
|
944 | 397 |
char == $E ifTrue:[ |
398 |
"/ ESC-E |
|
399 |
"/ TODO add_lines |
|
400 |
^ self doNothing |
|
401 |
]. |
|
402 |
(char == $Z) ifTrue:[ |
|
403 |
"/ terminal-type query 2 |
|
404 |
self reportTerminalType. |
|
405 |
^ self endOfSequence |
|
406 |
]. |
|
978 | 407 |
char == $= ifTrue: [ |
408 |
"/ ESC-= |
|
409 |
^ self doNothing |
|
410 |
]. |
|
411 |
char == $< ifTrue: [ |
|
412 |
"/ ESC-< |
|
413 |
^ self doNothing |
|
414 |
]. |
|
927 | 415 |
^ self doNothing |
416 |
]. |
|
417 |
||
944 | 418 |
state == #gotCSI ifTrue:[ |
927 | 419 |
"/ Currently, we are in ESC-[ state. |
420 |
"/ Decide what to do on the basis of the parameter char. |
|
421 |
||
978 | 422 |
char == $? ifTrue: [ |
423 |
state := #gotCSI2. |
|
424 |
^ self |
|
425 |
]. |
|
927 | 426 |
char == $; ifTrue:[ |
427 |
currentParam := (currentParam + 1) min: 8. |
|
428 |
^ self |
|
429 |
]. |
|
430 |
char isDigit ifTrue: [ |
|
431 |
^ self addToParameter:char |
|
432 |
]. |
|
433 |
char == $@ ifTrue: [ |
|
1020 | 434 |
self endEntry. |
951 | 435 |
self insertCharacters. |
436 |
^ self endOfSequence |
|
927 | 437 |
]. |
438 |
char == $A ifTrue: [ |
|
1020 | 439 |
self endEntry. |
951 | 440 |
self doCursorUp:((parameters at: 1) max: 1). |
927 | 441 |
^ self endOfSequence |
442 |
]. |
|
443 |
char == $B ifTrue: [ |
|
1020 | 444 |
self endEntry. |
1016
2d8e8b9bb9a5
fixed cursorLeft / cursorDown escape sequences.
Claus Gittinger <cg@exept.de>
parents:
1001
diff
changeset
|
445 |
self doCursorDown:((parameters at: 1) max: 1). |
927 | 446 |
^ self endOfSequence |
447 |
]. |
|
448 |
char == $C ifTrue: [ |
|
1020 | 449 |
self endEntry. |
927 | 450 |
self doCursorRight:((parameters at: 1) max: 1). |
451 |
^ self endOfSequence |
|
452 |
]. |
|
453 |
char == $D ifTrue: [ |
|
1020 | 454 |
self endEntry. |
1016
2d8e8b9bb9a5
fixed cursorLeft / cursorDown escape sequences.
Claus Gittinger <cg@exept.de>
parents:
1001
diff
changeset
|
455 |
self doCursorLeft:((parameters at: 1) max: 1). |
927 | 456 |
^ self endOfSequence |
457 |
]. |
|
458 |
char == $H ifTrue: [ |
|
1020 | 459 |
self endEntry. |
927 | 460 |
self move. |
461 |
^ self endOfSequence |
|
462 |
]. |
|
463 |
char == $J ifTrue: [ |
|
1020 | 464 |
self endEntry. |
927 | 465 |
self doClearDisplay. |
466 |
^ self endOfSequence |
|
467 |
]. |
|
468 |
char == $K ifTrue: [ |
|
1020 | 469 |
self endEntry. |
927 | 470 |
self clearLines. |
471 |
^ self endOfSequence |
|
472 |
]. |
|
473 |
char == $L ifTrue: [ |
|
1020 | 474 |
self endEntry. |
944 | 475 |
self insertLines. |
927 | 476 |
^ self endOfSequence |
477 |
]. |
|
478 |
char == $M ifTrue: [ |
|
1020 | 479 |
self endEntry. |
927 | 480 |
self deleteLines. |
481 |
^ self endOfSequence |
|
482 |
]. |
|
483 |
char == $P ifTrue: [ |
|
1020 | 484 |
self endEntry. |
927 | 485 |
self deleteCharacters. |
486 |
^ self endOfSequence |
|
487 |
]. |
|
944 | 488 |
(char == $c) ifTrue:[ |
489 |
"/ terminal-type query 3 |
|
490 |
self reportTerminalType. |
|
491 |
^ self endOfSequence |
|
492 |
]. |
|
493 |
char == $f ifTrue: [ |
|
1020 | 494 |
self endEntry. |
944 | 495 |
self move. |
496 |
^ self endOfSequence |
|
497 |
]. |
|
498 |
char == $n ifTrue: [ |
|
499 |
self report. |
|
500 |
^ self endOfSequence |
|
501 |
]. |
|
927 | 502 |
char == $m ifTrue: [ |
503 |
self displayMode: (parameters at: 1). |
|
504 |
^ self endOfSequence |
|
505 |
]. |
|
506 |
char == $r ifTrue: [ |
|
1020 | 507 |
self endEntry. |
927 | 508 |
self resetDefaults. |
509 |
^ self endOfSequence |
|
510 |
]. |
|
939 | 511 |
^ self doNothing |
927 | 512 |
]. |
513 |
||
944 | 514 |
state == #gotCSI2 ifTrue:[ |
927 | 515 |
"/ Currently, we are in ESC-[-? state. |
516 |
"/ Decide what to do on the basis of the parameter char. |
|
517 |
||
518 |
char == $; ifTrue: [ |
|
519 |
currentParam := (currentParam + 1) min: 8. |
|
520 |
^ self |
|
521 |
]. |
|
522 |
char isDigit ifTrue: [ |
|
523 |
self addToParameter: char. |
|
524 |
^ self |
|
525 |
]. |
|
949 | 526 |
(char == $l |
527 |
or:[char == $h]) ifTrue: [ |
|
528 |
"/ (parameters at: 1) = 1 ifTrue: [app_cur_keys:(char == $h)]. |
|
529 |
"/ (parameters at: 1) = 2 ifTrue: [mode132:(char == $h)]. |
|
530 |
"/ (parameters at: 1) = 4 ifTrue: [smoothScroll:(char == $h)]. |
|
531 |
"/ (parameters at: 1) = 5 ifTrue: [reverseVideo:(char == $h)]. |
|
532 |
"/ (parameters at: 1) = 6 ifTrue: [decom:(char == $h)]. |
|
1020 | 533 |
self endEntry. |
949 | 534 |
(parameters at: 1) = 7 ifTrue: [self autoMargin:(char == $h)]. |
951 | 535 |
^ self endOfSequence |
927 | 536 |
]. |
939 | 537 |
^ self doNothing |
927 | 538 |
]. |
933
de456e07697e
much better asynchronous display
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
539 |
|
1056 | 540 |
state == #gotCSI3 ifTrue:[ |
541 |
"/ Currently, we are in ESC-(-? state. |
|
542 |
"/ Decide what to do on the basis of the parameter char. |
|
543 |
||
544 |
"/ currently not supported |
|
545 |
^ self doNothing. |
|
546 |
]. |
|
547 |
||
944 | 548 |
state == #gotXTERMCSI ifTrue:[ |
549 |
"/ Currently, we are in ESC-] state. |
|
550 |
"/ Decide what to do on the basis of the parameter char. |
|
551 |
^ self doNothing |
|
552 |
]. |
|
553 |
||
927 | 554 |
self doNothing |
555 |
||
1020 | 556 |
"Modified: / 28.7.1998 / 00:18:01 / cg" |
920 | 557 |
! ! |
558 |
||
930 | 559 |
!VT100TerminalView methodsFor:'queries'! |
560 |
||
561 |
terminalType |
|
562 |
^ #vt100 |
|
563 |
||
564 |
"Created: / 10.6.1998 / 16:22:39 / cg" |
|
565 |
! ! |
|
566 |
||
920 | 567 |
!VT100TerminalView class methodsFor:'documentation'! |
568 |
||
569 |
version |
|
1340 | 570 |
^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.24 1999-04-26 14:43:02 cg Exp $' |
920 | 571 |
! ! |