The Trunk: Morphic-cmm.977.mcz

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

The Trunk: Morphic-cmm.977.mcz

commits-2
Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.977.mcz

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

Name: Morphic-cmm.977
Author: cmm
Time: 10 May 2015, 5:06:29.825 pm
UUID: 2f407c53-906b-4ba2-a818-b94723dbea9f
Ancestors: Morphic-cmm.976

Support the "Typing Blind" use case when Auto Enclose is enabled.

=============== Diff against Morphic-cmm.976 ===============

Item was changed:
  ----- Method: TextEditor>>dispatchOnKeyboardEvent: (in category 'typing support') -----
+ dispatchOnKeyboardEvent: aKeyboardEvent
+ "Carry out the action associated with this character, if any.   Type-ahead is passed so some routines can flush or use it."
+ | honorCommandKeys openers closers result typedChar |
+ ((typedChar := aKeyboardEvent keyCharacter) == Character cr and: [ morph acceptOnCR ]) ifTrue:
+ [ self closeTypeIn.
+ ^ true ].
- dispatchOnKeyboardEvent: aKeyboardEvent
- "Carry out the action associated with this character, if any.
- Type-ahead is passed so some routines can flush or use it."
-
- | honorCommandKeys openers closers result |
- (aKeyboardEvent keyCharacter == Character cr and: [ morph acceptOnCR ])
- ifTrue: [
- self closeTypeIn.
- ^ true ].
  self clearParens.
+ aKeyboardEvent keyValue = 13 ifTrue:
+ [ aKeyboardEvent controlKeyPressed ifTrue: [ ^ self normalCharacter: aKeyboardEvent ].
+ aKeyboardEvent shiftPressed ifTrue: [ ^ self lf: aKeyboardEvent ].
+ aKeyboardEvent commandKeyPressed ifTrue: [ ^ self crlf: aKeyboardEvent ].
+ ^ self crWithIndent: aKeyboardEvent ].
+ ((honorCommandKeys := Preferences cmdKeysInText) and: [ typedChar = Character enter ]) ifTrue: [ ^ self dispatchOnEnterWith: aKeyboardEvent ].
+ "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this
- aKeyboardEvent keyValue = 13
- ifTrue: [
- aKeyboardEvent controlKeyPressed
- ifTrue: [ ^ self normalCharacter: aKeyboardEvent ].
- aKeyboardEvent shiftPressed
- ifTrue: [ ^ self lf: aKeyboardEvent ].
- aKeyboardEvent commandKeyPressed
- ifTrue: [ ^ self crlf: aKeyboardEvent ].
- ^ self crWithIndent: aKeyboardEvent ].
- ((honorCommandKeys := Preferences cmdKeysInText) and: [ aKeyboardEvent keyCharacter = Character enter ])
- ifTrue: [ ^ self dispatchOnEnterWith: aKeyboardEvent ]. "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this
  conflict, assume that keys other than cursor keys aren't used together with Crtl."
+ ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [ aKeyboardEvent keyValue < 27 ]) ifTrue: [ ^ aKeyboardEvent controlKeyPressed
+ ifTrue:
+ [ self
+ perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
+ with: aKeyboardEvent ]
+ ifFalse:
+ [ self
+ perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
+ with: aKeyboardEvent ] ].
+ "backspace, and escape keys (ascii 8 and 27) are command keys"
+ ((honorCommandKeys and: [ aKeyboardEvent commandKeyPressed ]) or: [ self class specialShiftCmdKeys includes: aKeyboardEvent keyValue ]) ifTrue: [ ^ aKeyboardEvent shiftPressed
+ ifTrue:
+ [ self
+ perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
+ with: aKeyboardEvent ]
+ ifFalse:
+ [ self
+ perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
+ with: aKeyboardEvent ] ].
+ "the control key can be used to invoke shift-cmd shortcuts"
+ (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [ ^ self
+ perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
+ with: aKeyboardEvent ].
- ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [ aKeyboardEvent keyValue < 27 ])
- ifTrue: [
- ^ aKeyboardEvent controlKeyPressed
- ifTrue: [ self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent ]
- ifFalse: [ self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent ] ]. "backspace, and escape keys (ascii 8 and 27) are command keys"
- ((honorCommandKeys and: [ aKeyboardEvent commandKeyPressed ])
- or: [ self class specialShiftCmdKeys includes: aKeyboardEvent keyValue ])
- ifTrue: [
- ^ aKeyboardEvent shiftPressed
- ifTrue: [ self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent ]
- ifFalse: [ self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent ] ]. "the control key can be used to invoke shift-cmd shortcuts"
- (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ])
- ifTrue: [ ^ self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent ].
  openers := '([{'.
  closers := ')]}'.
+ (closers includes: typedChar)
+ ifTrue:
+ [ self blinkPrevParen: typedChar.
+ self nextNonwhitespaceCharacter = typedChar
+ ifTrue:
+ [ self moveCursor: [ : position | position + 1 ] forward: true select: false.
+ ^ false ]
+ ifFalse: [ result := self normalCharacter: aKeyboardEvent ] ]
+ ifFalse: [ result := self normalCharacter: aKeyboardEvent ].
+ (self class autoEnclose and: [ openers includes: typedChar ]) ifTrue:
+ [ self
+ addString: (closers at: (openers indexOf: typedChar)) asString ;
+ insertTypeAhead ;
+
+ moveCursor:
+ [ : position | position - 1 ]
+ forward: false
+ select: false ].
- result := self normalCharacter: aKeyboardEvent.
- (closers includes: aKeyboardEvent keyCharacter)
- ifTrue: [ self blinkPrevParen: aKeyboardEvent keyCharacter].
- (self class autoEnclose and: [ openers includes: aKeyboardEvent keyCharacter ])
- ifTrue: [
- self
- addString: (closers at: (openers indexOf: aKeyboardEvent keyCharacter)) asString;  
- insertTypeAhead ;
-
- moveCursor: [ :position | position - 1 ]
- forward: false
- select: false ].
  ^ result!

Item was added:
+ ----- Method: TextEditor>>nextNonwhitespaceCharacter (in category 'private') -----
+ nextNonwhitespaceCharacter
+ pointBlock stringIndex
+ to: paragraph string size
+ do:
+ [ : n | | char | (char := paragraph string at: n) isSeparator ifFalse: [ ^ char ] ].
+ ^ nil!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

marcel.taeumel
Can you elaborate on that "typing blind" use case? My eyes are always opened when I type. ;-) I just don't look at the keyboard but the screen while typing. Not sure what you mean here.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

Chris Muller-3
Transcribing some code from a sheet of paper.  You're looking at the
paper, not the screen, as you type.  In that case you want what you
typed to be what you typed..


On Sun, May 10, 2015 at 11:04 PM, marcel.taeumel <[hidden email]> wrote:

> Can you elaborate on that "typing blind" use case? My eyes are always opened
> when I type. ;-) I just don't look at the keyboard but the screen while
> typing. Not sure what you mean here.
>
> Best,
> Marcel
>
>
>
> --
> View this message in context: http://forum.world.st/The-Trunk-Morphic-cmm-977-mcz-tp4825591p4825620.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

marcel.taeumel
It seems that "Auto Enclose" is not honored correctly. It is disabled in my image but still seems to be enabled. :-(

Try typing "()" then move the cursor between the parentheses and type the closing one again. You will not end up with to closing ones...

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

Stéphane Rollandin
> It seems that "Auto Enclose" is not honored correctly. It is disabled in my
> image but still seems to be enabled. :-(
>
> Try typing "()" then move the cursor between the parentheses and type the
> closing one again. You will not end up with to closing ones...

Yes, I noticed that also, and it bothered me enough that I fixed it by
modifying TextEditor>> #dispatchOnKeyboardEvent: as follow:

----------------------------------------------

dispatchOnKeyboardEvent: aKeyboardEvent
        "Carry out the action associated with this character, if any.
Type-ahead is passed so some routines can flush or use it."
        | honorCommandKeys openers closers result typedChar |
        ((typedChar := aKeyboardEvent keyCharacter) == Character cr and: [
morph acceptOnCR ]) ifTrue:
                [ self closeTypeIn.
                ^ true ].
        self clearParens.
        aKeyboardEvent keyValue = 13 ifTrue:
                [ aKeyboardEvent controlKeyPressed ifTrue: [ ^ self normalCharacter:
aKeyboardEvent ].
                aKeyboardEvent shiftPressed ifTrue: [ ^ self lf: aKeyboardEvent ].
                aKeyboardEvent commandKeyPressed ifTrue: [ ^ self crlf: aKeyboardEvent ].
                ^ self crWithIndent: aKeyboardEvent ].
        ((honorCommandKeys := Preferences cmdKeysInText) and: [ typedChar =
Character enter ]) ifTrue: [ ^ self dispatchOnEnterWith: aKeyboardEvent ].
        "Special keys overwrite crtl+key combinations - at least on Windows. To
resolve this
        conflict, assume that keys other than cursor keys aren't used together
with Crtl."
        ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue)
and: [ aKeyboardEvent keyValue < 27 ]) ifTrue: [ ^ aKeyboardEvent
controlKeyPressed
                        ifTrue:
                                [ self
                                        perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ]
                        ifFalse:
                                [ self
                                        perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ] ].
        "backspace, and escape keys (ascii 8 and 27) are command keys"
        ((honorCommandKeys and: [ aKeyboardEvent commandKeyPressed ]) or: [
self class specialShiftCmdKeys includes: aKeyboardEvent keyValue ])
ifTrue: [ ^ aKeyboardEvent shiftPressed
                        ifTrue:
                                [ self
                                        perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ]
                        ifFalse:
                                [ self
                                        perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ] ].
        "the control key can be used to invoke shift-cmd shortcuts"
        (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [
^ self
                        perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
                        with: aKeyboardEvent ].
        openers := '([{'.
        closers := ')]}'.
        (closers includes: typedChar)
                ifTrue:
                        [ self blinkPrevParen: typedChar.
                        (self class autoEnclose and: [self nextNonwhitespaceCharacter =
typedChar])
                                ifTrue:
                                        [ self moveCursor: [ : position | position + 1 ] forward: true
select: false.
                                        ^ false ]
                                ifFalse: [ result := self normalCharacter: aKeyboardEvent ] ]
                ifFalse: [ result := self normalCharacter: aKeyboardEvent ].
        (self class autoEnclose and: [ openers includes: typedChar ]) ifTrue:
                [ self
                         addString: (closers at: (openers indexOf: typedChar)) asString ;
                         insertTypeAhead ;
                       
                        moveCursor:
                                [ : position | position - 1 ]
                        forward: false
                        select: false ].
        ^ result


----------------------------------------------

It looks like a correct fix to me.

Best,

Stef



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

Karl Ramberg

Stéphane Rollandins fix should be in the release image.

That bug is really annoying

Karl

On Tue, May 19, 2015 at 3:20 PM, Stéphane Rollandin <[hidden email]> wrote:
It seems that "Auto Enclose" is not honored correctly. It is disabled in my
image but still seems to be enabled. :-(

Try typing "()" then move the cursor between the parentheses and type the
closing one again. You will not end up with to closing ones...

Yes, I noticed that also, and it bothered me enough that I fixed it by modifying TextEditor>> #dispatchOnKeyboardEvent: as follow:

----------------------------------------------

dispatchOnKeyboardEvent: aKeyboardEvent
        "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it."
        | honorCommandKeys openers closers result typedChar |
        ((typedChar := aKeyboardEvent keyCharacter) == Character cr and: [ morph acceptOnCR ]) ifTrue:
                [ self closeTypeIn.
                ^ true ].
        self clearParens.
        aKeyboardEvent keyValue = 13 ifTrue:
                [ aKeyboardEvent controlKeyPressed ifTrue: [ ^ self normalCharacter: aKeyboardEvent ].
                aKeyboardEvent shiftPressed ifTrue: [ ^ self lf: aKeyboardEvent ].
                aKeyboardEvent commandKeyPressed ifTrue: [ ^ self crlf: aKeyboardEvent ].
                ^ self crWithIndent: aKeyboardEvent ].
        ((honorCommandKeys := Preferences cmdKeysInText) and: [ typedChar = Character enter ]) ifTrue: [ ^ self dispatchOnEnterWith: aKeyboardEvent ].
        "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this
        conflict, assume that keys other than cursor keys aren't used together with Crtl."
        ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [ aKeyboardEvent keyValue < 27 ]) ifTrue: [ ^ aKeyboardEvent controlKeyPressed
                        ifTrue:
                                [ self
                                        perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ]
                        ifFalse:
                                [ self
                                        perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ] ].
        "backspace, and escape keys (ascii 8 and 27) are command keys"
        ((honorCommandKeys and: [ aKeyboardEvent commandKeyPressed ]) or: [ self class specialShiftCmdKeys includes: aKeyboardEvent keyValue ]) ifTrue: [ ^ aKeyboardEvent shiftPressed
                        ifTrue:
                                [ self
                                        perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ]
                        ifFalse:
                                [ self
                                        perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ] ].
        "the control key can be used to invoke shift-cmd shortcuts"
        (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [ ^ self
                        perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
                        with: aKeyboardEvent ].
        openers := '([{'.
        closers := ')]}'.
        (closers includes: typedChar)
                ifTrue:
                        [ self blinkPrevParen: typedChar.
                        (self class autoEnclose and: [self nextNonwhitespaceCharacter = typedChar])
                                ifTrue:
                                        [ self moveCursor: [ : position | position + 1 ] forward: true select: false.
                                        ^ false ]
                                ifFalse: [ result := self normalCharacter: aKeyboardEvent ] ]
                ifFalse: [ result := self normalCharacter: aKeyboardEvent ].
        (self class autoEnclose and: [ openers includes: typedChar ]) ifTrue:
                [ self
                         addString: (closers at: (openers indexOf: typedChar)) asString ;
                         insertTypeAhead ;
                       
                        moveCursor:
                                [ : position | position - 1 ]
                        forward: false
                        select: false ].
        ^ result


----------------------------------------------

It looks like a correct fix to me.

Best,

Stef






Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

Chris Muller-3
Yes, I've cut'n'pasted his method out of his email, and it works, but does anyone (Marcel?) know why the cursor disappears after typing ()?

I haven't had a chance to figure that out yet, I want to fix both..

On Thu, May 28, 2015 at 9:11 AM, karl ramberg <[hidden email]> wrote:

Stéphane Rollandins fix should be in the release image.

That bug is really annoying

Karl

On Tue, May 19, 2015 at 3:20 PM, Stéphane Rollandin <[hidden email]> wrote:
It seems that "Auto Enclose" is not honored correctly. It is disabled in my
image but still seems to be enabled. :-(

Try typing "()" then move the cursor between the parentheses and type the
closing one again. You will not end up with to closing ones...

Yes, I noticed that also, and it bothered me enough that I fixed it by modifying TextEditor>> #dispatchOnKeyboardEvent: as follow:

----------------------------------------------

dispatchOnKeyboardEvent: aKeyboardEvent
        "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it."
        | honorCommandKeys openers closers result typedChar |
        ((typedChar := aKeyboardEvent keyCharacter) == Character cr and: [ morph acceptOnCR ]) ifTrue:
                [ self closeTypeIn.
                ^ true ].
        self clearParens.
        aKeyboardEvent keyValue = 13 ifTrue:
                [ aKeyboardEvent controlKeyPressed ifTrue: [ ^ self normalCharacter: aKeyboardEvent ].
                aKeyboardEvent shiftPressed ifTrue: [ ^ self lf: aKeyboardEvent ].
                aKeyboardEvent commandKeyPressed ifTrue: [ ^ self crlf: aKeyboardEvent ].
                ^ self crWithIndent: aKeyboardEvent ].
        ((honorCommandKeys := Preferences cmdKeysInText) and: [ typedChar = Character enter ]) ifTrue: [ ^ self dispatchOnEnterWith: aKeyboardEvent ].
        "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this
        conflict, assume that keys other than cursor keys aren't used together with Crtl."
        ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [ aKeyboardEvent keyValue < 27 ]) ifTrue: [ ^ aKeyboardEvent controlKeyPressed
                        ifTrue:
                                [ self
                                        perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ]
                        ifFalse:
                                [ self
                                        perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ] ].
        "backspace, and escape keys (ascii 8 and 27) are command keys"
        ((honorCommandKeys and: [ aKeyboardEvent commandKeyPressed ]) or: [ self class specialShiftCmdKeys includes: aKeyboardEvent keyValue ]) ifTrue: [ ^ aKeyboardEvent shiftPressed
                        ifTrue:
                                [ self
                                        perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ]
                        ifFalse:
                                [ self
                                        perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
                                        with: aKeyboardEvent ] ].
        "the control key can be used to invoke shift-cmd shortcuts"
        (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [ ^ self
                        perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
                        with: aKeyboardEvent ].
        openers := '([{'.
        closers := ')]}'.
        (closers includes: typedChar)
                ifTrue:
                        [ self blinkPrevParen: typedChar.
                        (self class autoEnclose and: [self nextNonwhitespaceCharacter = typedChar])
                                ifTrue:
                                        [ self moveCursor: [ : position | position + 1 ] forward: true select: false.
                                        ^ false ]
                                ifFalse: [ result := self normalCharacter: aKeyboardEvent ] ]
                ifFalse: [ result := self normalCharacter: aKeyboardEvent ].
        (self class autoEnclose and: [ openers includes: typedChar ]) ifTrue:
                [ self
                         addString: (closers at: (openers indexOf: typedChar)) asString ;
                         insertTypeAhead ;
                       
                        moveCursor:
                                [ : position | position - 1 ]
                        forward: false
                        select: false ].
        ^ result


----------------------------------------------

It looks like a correct fix to me.

Best,

Stef










Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

marcel.taeumel (old)
I can take a look at it.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

marcel.taeumel
In reply to this post by Chris Muller-3
I can take a look at it.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

marcel.taeumel
In reply to this post by Chris Muller-3
Hmm... I cannot reproduce this bug. Looks fine here. Can you tell about your preferences in your working image?

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

Chris Muller-3
In updated TrunkImage, turn on Auto Enclose.

Then type () in a workspace.

For me, the cursor disappears.

On Fri, May 29, 2015 at 1:51 AM, marcel.taeumel <[hidden email]> wrote:

> Hmm... I cannot reproduce this bug. Looks fine here. Can you tell about your
> preferences in your working image?
>
> Best,
> Marcel
>
>
>
> --
> View this message in context: http://forum.world.st/The-Trunk-Morphic-cmm-977-mcz-tp4825591p4829239.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.977.mcz

Levente Uzonyi-2
In reply to this post by Karl Ramberg
The code is also broken, when Auto Enclose is enabled. The cause of the
problem is that code ignores the number of whitespace characters. If you
open a workspace and type the following line:

      ] "five spaces and a closing bracket"

and move the cursor to the beginning of the line, then you have to press ]
seven times to make another closing bracket appear.

Levente

On Thu, 28 May 2015, karl ramberg wrote:

>
>   Stéphane Rollandins fix should be in the release image.
>
> That bug is really annoying
>
> Karl
>
> On Tue, May 19, 2015 at 3:20 PM, Stéphane Rollandin <[hidden email]> wrote:
>             It seems that "Auto Enclose" is not honored correctly. It is disabled in my
>             image but still seems to be enabled. :-(
>
>             Try typing "()" then move the cursor between the parentheses and type the
>             closing one again. You will not end up with to closing ones...
>
>
>       Yes, I noticed that also, and it bothered me enough that I fixed it by modifying TextEditor>> #dispatchOnKeyboardEvent: as follow:
>
>       ----------------------------------------------
>
>       dispatchOnKeyboardEvent: aKeyboardEvent
>               "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it."
>               | honorCommandKeys openers closers result typedChar |
>               ((typedChar := aKeyboardEvent keyCharacter) == Character cr and: [ morph acceptOnCR ]) ifTrue:
>                       [ self closeTypeIn.
>                       ^ true ].
>               self clearParens.
>               aKeyboardEvent keyValue = 13 ifTrue:
>                       [ aKeyboardEvent controlKeyPressed ifTrue: [ ^ self normalCharacter: aKeyboardEvent ].
>                       aKeyboardEvent shiftPressed ifTrue: [ ^ self lf: aKeyboardEvent ].
>                       aKeyboardEvent commandKeyPressed ifTrue: [ ^ self crlf: aKeyboardEvent ].
>                       ^ self crWithIndent: aKeyboardEvent ].
>               ((honorCommandKeys := Preferences cmdKeysInText) and: [ typedChar = Character enter ]) ifTrue: [ ^ self dispatchOnEnterWith: aKeyboardEvent ].
>               "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this
>               conflict, assume that keys other than cursor keys aren't used together with Crtl."
>               ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [ aKeyboardEvent keyValue < 27 ]) ifTrue: [ ^ aKeyboardEvent controlKeyPressed
>                               ifTrue:
>                                       [ self
>                                               perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
>                                               with: aKeyboardEvent ]
>                               ifFalse:
>                                       [ self
>                                               perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
>                                               with: aKeyboardEvent ] ].
>               "backspace, and escape keys (ascii 8 and 27) are command keys"
>               ((honorCommandKeys and: [ aKeyboardEvent commandKeyPressed ]) or: [ self class specialShiftCmdKeys includes: aKeyboardEvent keyValue ]) ifTrue: [ ^ aKeyboardEvent shiftPressed
>                               ifTrue:
>                                       [ self
>                                               perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
>                                               with: aKeyboardEvent ]
>                               ifFalse:
>                                       [ self
>                                               perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
>                                               with: aKeyboardEvent ] ].
>               "the control key can be used to invoke shift-cmd shortcuts"
>               (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [ ^ self
>                               perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
>                               with: aKeyboardEvent ].
>               openers := '([{'.
>               closers := ')]}'.
>               (closers includes: typedChar)
>                       ifTrue:
>                               [ self blinkPrevParen: typedChar.
>                               (self class autoEnclose and: [self nextNonwhitespaceCharacter = typedChar])
>                                       ifTrue:
>                                               [ self moveCursor: [ : position | position + 1 ] forward: true select: false.
>                                               ^ false ]
>                                       ifFalse: [ result := self normalCharacter: aKeyboardEvent ] ]
>                       ifFalse: [ result := self normalCharacter: aKeyboardEvent ].
>               (self class autoEnclose and: [ openers includes: typedChar ]) ifTrue:
>                       [ self
>                                addString: (closers at: (openers indexOf: typedChar)) asString ;
>                                insertTypeAhead ;
>                              
>                               moveCursor:
>                                       [ : position | position - 1 ]
>                               forward: false
>                               select: false ].
>               ^ result
>
>
>       ----------------------------------------------
>
>       It looks like a correct fix to me.
>
>       Best,
>
>       Stef
>
>
>
>
>
>