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