Running the following script in Morphic with a transcript open, I get
some unexpected behavior.
If you type a few keys, the transcript seems to correctly and timely
capture all the key events.
However, if I type a long sentence, along the lines of "Now is the
winter of our Discontent, made glorious Summer by this son of
York....!", all the key events appear to be captured, but after half
of the events click by, there is a long pause (about a second or so)
between each event.
Hitting the shift key a few times seems to accelerate things
somewhat, but, something seems wrongful.
I started scanning the code, but I couldn't immediately identify the
clear source of the problem. Any thoughts?
"Exercise Keyboard stuff"
showKeyEvent _ [:evt |
((evt at: 4)
caseOf: {
[0]->['character $', (evt at: 3) asCharacter
asString, '(', (evt at: 3) asString,')'].
[1]->['keyDown ', (evt at: 3) asString].
[2]->['keyUp ', (evt at: 3) asString]}
otherwise: ['error']), ' [', ((evt at: 5) radix: 2), ']'].
[((evt _ Sensor nextEvent) isNil not and: [(evt at: 1) = 2]) ifTrue:
[Transcript show: Sensor eventQueue size asString, ': '.
Transcript show: (showKeyEvent value: evt); cr]] repeat