<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Georgia">I fear that doesn't even work with ordinary
USASCII input. I tweaked readKeyboard to simulate additional
characters arriving in close succession:<br>
<br>
self hasSelection ifTrue: "save highlighted characters"<br>
[UndoSelection := self selection]. <br>
<b>((model isKindOf: Workspace) and: [char = $z]) ifTrue:
[typeAhead nextPutAll: '123'].</b><br>
<br>
self zapSelectionWithCompositionWith: typeAhead contents.<br>
<br>
and what I get by typing some z's in a Workspace is:<br>
<br>
z123zzzzzz123123123123123123<br>
<br>
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:<br>
<br>
self deselect.<br>
<b>sensor keyboardPressed ifTrue: "was a whileTrue:"</b><br>
[char := sensor keyboardPeek.<br>
(self dispatchOnCharacter: char with: typeAhead)
ifTrue:<br>
[self doneTyping.<br>
self setEmphasisHere.<br>
^self selectAndScroll; updateMarker].<br>
self openTypeIn].<br>
<br>
Cheers,<br>
Bob<br>
<br>
</font>
<div class="moz-cite-prefix">On 2/9/13 1:01 AM,
<a class="moz-txt-link-abbreviated" href="mailto:commits@source.squeak.org">commits@source.squeak.org</a> wrote:<br>
</div>
<blockquote cite="mid:md5:RAUVOwiXMyB2NzGbW+7nrg==" type="cite">
<pre wrap="">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.</pre>
</blockquote>
<br>
</body>
</html>