[squeak-dev] wait2ms (The Trunk: ST80-dtl.141.mcz)
David T. Lewis
lewis at mail.msen.com
Sun Feb 10 14:52:33 UTC 2013
On Sat, Feb 09, 2013 at 05:54:49PM -0800, Yoshiki Ohshima wrote:
> On Sat, Feb 9, 2013 at 5:44 PM, Bob Arning <arning315 at comcast.net> wrote:
> > One final oddity - this zapSelectionWithCompositionWith: seems to have
> > appeared in squeak 4.1 at the same time as new editors were introduced on
> > the morphic side. There is no sign of this composition business in the new
> > morphic editors. I wonder if that was a design decision or just a fork that
> > happened and somebody changed one fork and not the other. This leads me to
> > think that ditching zapSelectionWithCompositionWith: would not be missed by
> > anyone.
>
> This is probably the right observation. As I wrote in another email,
> #zapSelectionWithCompositionWith: was written for the OLPC Etoys
> image, independent from the editor rewrite work going on in the trunk
> image. I even wasn't aware that this is in the trunk, and nobody else
> was really paying attention.
>
> That said, it should be the right thing to keep this method in and fix
> the editor (which is as simple as David did. Just assume multiple
> characters coming in and have a loop).
>
Hi Yoshiki,
Thank you for explaining this.
I am still confused on one point. Can you say if the #zapSelectionWithCompositionWith:
method should be changed? Here is the change that I was proposing:
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.
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]
But I do not know if this is correct, or if we should leave the method
as it is now:
( ... )
Text := 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 zapSelectionWith: aText.
Thanks for your help.
Dave
More information about the Squeak-dev
mailing list
|