author | Claus Gittinger <cg@exept.de> |
Wed, 05 May 1999 16:31:47 +0200 | |
changeset 1356 | 68b9f4468961 |
parent 1353 | fbac065072ce |
child 1362 | 178613e27d74 |
permissions | -rw-r--r-- |
914 | 1 |
TerminalView subclass:#VT52TerminalView |
998 | 2 |
instanceVariableNames:'param1 param2' |
914 | 3 |
classVariableNames:'' |
4 |
poolDictionaries:'' |
|
5 |
category:'Views-TerminalViews' |
|
6 |
! |
|
7 |
||
8 |
!VT52TerminalView class methodsFor:'documentation'! |
|
9 |
||
10 |
documentation |
|
11 |
" |
|
12 |
VT52 terminal |
|
13 |
||
14 |
[start with:] |
|
916 | 15 |
VT52TerminalView openShell |
914 | 16 |
" |
17 |
||
18 |
! ! |
|
19 |
||
20 |
!VT52TerminalView methodsFor:'defaults'! |
|
21 |
||
22 |
vt52KeyCodes |
|
23 |
^ IdentityDictionary withKeysAndValues: |
|
24 |
#( |
|
25 |
#CursorUp '\eA' |
|
26 |
#CursorDown '\eB' |
|
927 | 27 |
#CursorRight '\eC' |
28 |
#CursorLeft '\eD' |
|
914 | 29 |
#Home '\eH' |
30 |
#Escape '\e' |
|
927 | 31 |
#BackSpace '\b' |
914 | 32 |
#Return '\r' |
976 | 33 |
#Delete '\0177' |
1356 | 34 |
#Tab '\t' |
914 | 35 |
) |
927 | 36 |
|
1356 | 37 |
"Modified: / 5.5.1999 / 15:01:37 / cg" |
914 | 38 |
! ! |
39 |
||
956 | 40 |
!VT52TerminalView methodsFor:'events'! |
41 |
||
42 |
defineWindowSize |
|
43 |
super defineWindowSize. |
|
980 | 44 |
rangeEndLine := numberOfLines |
956 | 45 |
|
46 |
"Created: / 13.6.1998 / 18:15:43 / cg" |
|
980 | 47 |
"Modified: / 20.6.1998 / 20:33:29 / cg" |
956 | 48 |
! ! |
49 |
||
914 | 50 |
!VT52TerminalView methodsFor:'initialization'! |
51 |
||
52 |
initialize |
|
53 |
super initialize. |
|
949 | 54 |
self endOfSequence. |
914 | 55 |
|
980 | 56 |
"Modified: / 20.6.1998 / 20:34:18 / cg" |
914 | 57 |
! |
58 |
||
59 |
initializeKeyboardSequences |
|
60 |
kbdSequences := (self vt52KeyCodes) |
|
61 |
||
62 |
||
63 |
! ! |
|
64 |
||
932 | 65 |
!VT52TerminalView methodsFor:'processing - input'! |
66 |
||
949 | 67 |
doNothing |
68 |
self endOfSequence |
|
69 |
||
70 |
"Created: / 12.6.1998 / 20:40:43 / cg" |
|
71 |
! |
|
932 | 72 |
|
949 | 73 |
endOfSequence |
74 |
state := 0. |
|
932 | 75 |
|
949 | 76 |
"Created: / 12.6.1998 / 20:39:52 / cg" |
77 |
! |
|
932 | 78 |
|
949 | 79 |
nextPut:char |
80 |
"process a character (i.e. the shells output)" |
|
81 |
||
82 |
"/ Transcript show:state; show:' '; showCR:char storeString. |
|
83 |
||
84 |
state == #gotReturn ifTrue:[ |
|
85 |
state := 0. |
|
86 |
char == Character nl ifTrue:[ |
|
87 |
"/ cr-nl |
|
88 |
"/ stay in buffering mode. |
|
89 |
super nextPut:Character cr. |
|
90 |
^ self. |
|
932 | 91 |
]. |
949 | 92 |
self endEntry. |
93 |
self cursorToBeginOfLine. |
|
94 |
"/ continue in initial state |
|
932 | 95 |
]. |
96 |
||
949 | 97 |
state == 0 ifTrue:[ |
98 |
"/ Currently, we are in initial state. |
|
99 |
"/ Decide what to do on the basis of the parameter char. |
|
100 |
||
101 |
(char == Character esc) ifTrue:[ |
|
102 |
self endEntry. |
|
103 |
state := #gotESC. |
|
104 |
^ self |
|
105 |
]. |
|
106 |
(char == Character nl) ifTrue:[ |
|
956 | 107 |
self doCursorDown:1. |
108 |
^ self endEntry. |
|
949 | 109 |
]. |
110 |
(char == Character return) ifTrue:[ |
|
980 | 111 |
(rangeEndLine notNil and:[rangeEndLine ~~ numberOfLines]) ifTrue:[ |
956 | 112 |
self endEntry. |
113 |
self cursorToBeginOfLine. |
|
114 |
] ifFalse:[ |
|
115 |
state := #gotReturn. |
|
116 |
]. |
|
949 | 117 |
^ self. |
118 |
]. |
|
119 |
(char == Character backspace) ifTrue:[ |
|
956 | 120 |
self doCursorLeft. "/ doBackspace |
121 |
^ self endEntry. |
|
949 | 122 |
]. |
123 |
(char == Character bell) ifTrue:[ |
|
124 |
self beep. |
|
125 |
^ self |
|
126 |
]. |
|
127 |
char asciiValue < 32 ifTrue:[ |
|
956 | 128 |
char ~~ Character tab ifTrue:[ |
980 | 129 |
char asciiValue ~~ 0 ifTrue:[ |
130 |
Transcript show:'unhandled control key: '; showCR:char storeString. |
|
131 |
]. |
|
132 |
^ self. |
|
956 | 133 |
] |
949 | 134 |
]. |
135 |
^ super nextPut:char |
|
932 | 136 |
]. |
949 | 137 |
|
138 |
state == #gotESC ifTrue:[ |
|
139 |
"/ Currently, we are in ESC state. |
|
140 |
"/ Decide what to do on the basis of the parameter char. |
|
932 | 141 |
|
949 | 142 |
char == $A ifTrue:[ |
143 |
"/ ESC-A |
|
956 | 144 |
self doCursorUp:1. |
949 | 145 |
^ self endOfSequence |
146 |
]. |
|
147 |
char == $B ifTrue:[ |
|
148 |
"/ ESC-B |
|
956 | 149 |
self doCursorDown:1. |
949 | 150 |
^ self endOfSequence |
151 |
]. |
|
152 |
char == $C ifTrue:[ |
|
153 |
"/ ESC-C |
|
956 | 154 |
self doCursorRight:1. |
949 | 155 |
^ self endOfSequence |
156 |
]. |
|
157 |
char == $D ifTrue:[ |
|
158 |
"/ ESC-D |
|
956 | 159 |
self doCursorLeft:1. |
949 | 160 |
^ self endOfSequence |
161 |
]. |
|
162 |
char == $H ifTrue: [ |
|
163 |
"/ ESC-H |
|
164 |
self doCursorHome. |
|
165 |
^ self endOfSequence |
|
166 |
]. |
|
167 |
char == $J ifTrue: [ |
|
168 |
"/ ESC-J |
|
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
169 |
self doClearToEndOfScreen. |
949 | 170 |
^ self endOfSequence |
171 |
]. |
|
956 | 172 |
char == $K ifTrue: [ |
173 |
"/ ESC-J |
|
174 |
self doClearToEndOfLine. |
|
175 |
^ self endOfSequence |
|
176 |
]. |
|
177 |
char == $Y ifTrue: [ |
|
178 |
"/ ESC-Y - cursor positioning |
|
179 |
state := #motion1. |
|
180 |
^ self |
|
181 |
]. |
|
949 | 182 |
Transcript show:'unhandled esc-key: '; showCR:char storeString. |
183 |
]. |
|
184 |
||
956 | 185 |
state == #motion1 ifTrue:[ |
186 |
"/ char-value - 32 is line |
|
187 |
param1 := (char asciiValue - 32). |
|
188 |
state := #motion2. |
|
189 |
^ self. |
|
190 |
]. |
|
191 |
state == #motion2 ifTrue:[ |
|
192 |
"/ char-value - 32 is col |
|
193 |
param2 := (char asciiValue - 32). |
|
194 |
"/ Transcript show:'motion '; show:param1+1; show:' '; showCR:param2+1. |
|
195 |
self cursorVisibleLine:param1+1 col:param2+1. |
|
196 |
^ self endOfSequence |
|
197 |
]. |
|
198 |
||
949 | 199 |
self doNothing |
200 |
||
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
201 |
"Modified: / 21.7.1998 / 20:06:04 / cg" |
932 | 202 |
! ! |
203 |
||
204 |
!VT52TerminalView methodsFor:'queries'! |
|
205 |
||
206 |
terminalType |
|
1353 | 207 |
^ 'vt52' |
932 | 208 |
|
209 |
"Created: / 10.6.1998 / 16:22:46 / cg" |
|
1353 | 210 |
"Modified: / 5.5.1999 / 11:22:50 / cg" |
932 | 211 |
! ! |
212 |
||
914 | 213 |
!VT52TerminalView class methodsFor:'documentation'! |
214 |
||
215 |
version |
|
1356 | 216 |
^ '$Header: /cvs/stx/stx/libwidg2/VT52TerminalView.st,v 1.13 1999-05-05 14:31:47 cg Exp $' |
914 | 217 |
! ! |