The Trunk: ST80-dtl.142.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: ST80-dtl.142.mcz

commits-2
David T. Lewis uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-dtl.142.mcz

==================== Summary ====================

Name: ST80-dtl.142
Author: dtl
Time: 9 February 2013, 3:32:31.743 pm
UUID: 70a0ff8e-c49b-472b-a70d-58c0948a4cb4
Ancestors: ST80-dtl.141

Revert last change to zapSelectionWithCompositionWith: because original implementation is required for multilingual support.

Change ParagraphEditor>>readKeyboard to always process one character at a time per suggestion from Bob Arning.

Background and explanation at http://lists.squeakfoundation.org/pipermail/squeak-dev/2013-February/168725.html

=============== Diff against ST80-dtl.141 ===============

Item was changed:
  ----- Method: ParagraphEditor>>readKeyboard (in category 'typing support') -----
  readKeyboard
  "Key struck on the keyboard. Find out which one and, if special, carry
  out the associated special action. Otherwise, add the character to the
  stream of characters.  Undoer & Redoer: see closeTypeIn."
 
  | typeAhead char |
  typeAhead := WriteStream on: (String new: 128).
  [sensor keyboardPressed] whileTrue:
  [self deselect.
+ sensor keyboardPressed ifTrue:
- [sensor keyboardPressed] whileTrue:
  [char := sensor keyboardPeek.
  (self dispatchOnCharacter: char with: typeAhead) ifTrue:
  [self doneTyping.
  self setEmphasisHere.
  ^self selectAndScroll; updateMarker].
  self openTypeIn].
  self hasSelection ifTrue: "save highlighted characters"
  [UndoSelection := self selection].
  self zapSelectionWithCompositionWith: typeAhead contents.
  typeAhead reset.
  self unselect.
  sensor keyboardPressed ifFalse:
  [self selectAndScroll.
  sensor keyboardPressed
  ifFalse: [self updateMarker]]]!

Item was changed:
  ----- Method: ParagraphEditor>>zapSelectionWithCompositionWith: (in category 'accessing-selection') -----
  zapSelectionWithCompositionWith: aString
  "Deselect, and replace the selection text by aString.
  Remember the resulting selectionInterval in UndoInterval and otherInterval.
  Do not set up for undo."
 
  | stream newString aText beforeChar |
  wasComposition := false.
  ((aString isEmpty or: [(beforeChar := self charBefore) isNil]) or: [
  aString size = 1 and: [(Unicode isComposition: aString first) not]]) ifTrue: [
  ^ self zapSelectionWith: (Text string: aString emphasis: emphasisHere)].
 
  stream := UnicodeCompositionStream on: (String new: 16).
  stream nextPut: beforeChar.
  stream nextPutAll: aString.
  newString := stream contents.
  aText := Text string: newString emphasis: emphasisHere.
- wasComposition := true.
  self markBlock < self pointBlock
+ ifTrue: [self setMark: self markBlock stringIndex - 1]
+ ifFalse: [self setPoint: self  pointBlock stringIndex - 1].
+
+ wasComposition := true.
+ self zapSelectionWith: aText.
- 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]
  !