<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>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self hasSelection ifTrue: "save highlighted characters"<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [UndoSelection := self selection]. <br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <b>((model isKindOf: Workspace) and: [char = $z]) ifTrue:
        [typeAhead nextPutAll: '123'].</b><br>
      <br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 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>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self deselect.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<b>sensor keyboardPressed ifTrue: "was a whileTrue:"</b><br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [char := sensor keyboardPeek.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (self dispatchOnCharacter: char with: typeAhead)
      ifTrue:<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [self doneTyping.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self setEmphasisHere.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ^self selectAndScroll; updateMarker].<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 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 &lt; self pointBlock
-                 ifTrue: [self setMark: self markBlock stringIndex - 1]
-                 ifFalse: [self setPoint: self  pointBlock stringIndex - 1].

          wasComposition := true. 
+         self markBlock &lt; 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>