[squeak-dev] The Trunk: ST80-dtl.141.mcz
Bob Arning
arning315 at comcast.net
Sat Feb 9 11:52:43 UTC 2013
I fear that doesn't even work with ordinary USASCII input. I tweaked
readKeyboard to simulate additional characters arriving in close succession:
self hasSelection ifTrue: "save highlighted characters"
[UndoSelection := self selection].
*((model isKindOf: Workspace) and: [char = $z]) ifTrue: [typeAhead
nextPutAll: '123'].*
self zapSelectionWithCompositionWith: typeAhead contents.
and what I get by typing some z's in a Workspace is:
z123zzzzzz123123123123123123
I think the safest way to guard against multiple characters arriving in
quick succession is to simply process each one completely before
proceeding to the next. This, after all, is the likeliest case by far
for modern computers and ordinary humans typing:
self deselect.
*sensor keyboardPressed ifTrue: "was a whileTrue:"*
[char := sensor keyboardPeek.
(self dispatchOnCharacter: char with: typeAhead) ifTrue:
[self doneTyping.
self setEmphasisHere.
^self selectAndScroll; updateMarker].
self openTypeIn].
Cheers,
Bob
On 2/9/13 1:01 AM, commits at source.squeak.org wrote:
> aText := Text string: newString emphasis: emphasisHere.
> - self markBlock < self pointBlock
> - ifTrue: [self setMark: self markBlock stringIndex - 1]
> - ifFalse: [self setPoint: self pointBlock stringIndex - 1].
> -
> wasComposition := true.
> + self markBlock < self pointBlock
> + ifTrue: [ self setMark: self markBlock stringIndex - 1.
> + self zapSelectionWith: aText.
> + self setMark: self markBlock stringIndex + 1]
> + ifFalse: [ self setPoint: self pointBlock stringIndex - 1.
> + self zapSelectionWith: aText.
> + self setPoint: self pointBlock stringIndex + 1]
> - self zapSelectionWith: aText.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130209/3e435138/attachment.htm
More information about the Squeak-dev
mailing list
|