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