Thanks!<div><br></div><div>Richo<br><br><div class="gmail_quote">On Fri, Oct 7, 2011 at 5:49 AM, <span dir="ltr"><<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Bert Freudenberg uploaded a new version of Morphic to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Morphic-Richo.583.mcz" target="_blank">http://source.squeak.org/trunk/Morphic-Richo.583.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Morphic-Richo.583<br>
Author: Richo<br>
Time: 6 October 2011, 4:29:55.07 pm<br>
UUID: 4df53f26-036e-3c4a-8a98-af5e787d3ada<br>
Ancestors: Morphic-ul.582<br>
<br>
After installing OCompletion typing any of the following characters ')]}' signals an MNU: Character>>#keyCharacter.<br>
<br>
This commit seems to fix the problem by making SmalltalkEditor>>#blinkPrevParen: always receive a character instead of a KeyboardEvent.<br>
<br>
I lacked the courage to change TextEditor>>#blinkPrevParen: but I think it should be changed as well for consistency.<br>
<br>
=============== Diff against Morphic-ul.582 ===============<br>
<br>
Item was changed:<br>
----- Method: SmalltalkEditor>>blinkPrevParen: (in category 'parenblinking') -----<br>
+ blinkPrevParen: aCharacter<br>
- blinkPrevParen: aKeyboardEvent<br>
"Same as super, but tries to follow the Smalltalk syntax."<br>
<br>
| openDelimiter closeDelimiter level string here inside |<br>
string := paragraph text string.<br>
here := pointBlock stringIndex.<br>
+ openDelimiter := aCharacter.<br>
- openDelimiter := aKeyboardEvent keyCharacter.<br>
closeDelimiter := '([{' at: (')]}' indexOf: openDelimiter).<br>
level := 1.<br>
inside := nil. "Tricky."<br>
(here > 1 and: [ (string at: here - 1) = $$ ]) ifTrue: [ ^self ]. "Just a character literal."<br>
[ level > 0 and: [ here > 1 ] ] whileTrue: [<br>
| hereChar |<br>
hereChar := string at: (here := here - 1).<br>
inside "Are we inside a comment or string literal?"<br>
ifNotNil: [ "Yes."<br>
hereChar = inside ifTrue: [<br>
(here > 1 and: [ (string at: here - 1) ~= inside ])<br>
ifTrue: [ inside := nil ]<br>
ifFalse: [ here := here - 1 ] ] ]<br>
ifNil: [<br>
(here > 1 and: [ (string at: here - 1) = $$ ]) "Just a character literal."<br>
ifTrue: [ here := here - 1 ]<br>
ifFalse: [<br>
hereChar<br>
caseOf: {<br>
[ closeDelimiter ] -> [<br>
(level := level - 1) = 0 ifTrue: [<br>
^self blinkParenAt: here ] ].<br>
[ openDelimiter ] -> [ level := level + 1 ].<br>
[ $" ] -> [ inside := $" ].<br>
[ $' ] -> [ inside := $' ] }<br>
otherwise: [] ] ] ]!<br>
<br>
Item was changed:<br>
----- Method: TextEditor>>dispatchOnKeyboardEvent: (in category 'typing support') -----<br>
dispatchOnKeyboardEvent: aKeyboardEvent<br>
"Carry out the action associated with this character, if any.<br>
Type-ahead is passed so some routines can flush or use it."<br>
<br>
| honorCommandKeys openers closers result |<br>
(aKeyboardEvent keyCharacter == Character cr and: [ morph acceptOnCR ])<br>
ifTrue: [<br>
self closeTypeIn.<br>
^ true ].<br>
self clearParens.<br>
aKeyboardEvent keyValue = 13<br>
ifTrue: [<br>
aKeyboardEvent controlKeyPressed<br>
ifTrue: [ ^ self normalCharacter: aKeyboardEvent ].<br>
aKeyboardEvent shiftPressed<br>
ifTrue: [ ^ self lf: aKeyboardEvent ].<br>
aKeyboardEvent commandKeyPressed<br>
ifTrue: [ ^ self crlf: aKeyboardEvent ].<br>
^ self crWithIndent: aKeyboardEvent ].<br>
((honorCommandKeys := Preferences cmdKeysInText) and: [ aKeyboardEvent keyCharacter = Character enter ])<br>
ifTrue: [ ^ self dispatchOnEnterWith: aKeyboardEvent ]. "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this<br>
conflict, assume that keys other than cursor keys aren't used together with Crtl."<br>
((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [ aKeyboardEvent keyValue < 27 ])<br>
ifTrue: [<br>
^ aKeyboardEvent controlKeyPressed<br>
ifTrue: [ self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent ]<br>
ifFalse: [ self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent ] ]. "backspace, and escape keys (ascii 8 and 27) are command keys"<br>
((honorCommandKeys and: [ aKeyboardEvent commandKeyPressed ])<br>
or: [ self class specialShiftCmdKeys includes: aKeyboardEvent keyValue ])<br>
ifTrue: [<br>
^ aKeyboardEvent shiftPressed<br>
ifTrue: [ self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent ]<br>
ifFalse: [ self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent ] ]. "the control key can be used to invoke shift-cmd shortcuts"<br>
(honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ])<br>
ifTrue: [ ^ self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent ].<br>
openers := '([{'.<br>
closers := ')]}'.<br>
result := self normalCharacter: aKeyboardEvent.<br>
(closers includes: aKeyboardEvent keyCharacter)<br>
+ ifTrue: [ self blinkPrevParen: aKeyboardEvent keyCharacter].<br>
- ifTrue: [ self blinkPrevParen: aKeyboardEvent ].<br>
(self class autoEnclose and: [ openers includes: aKeyboardEvent keyCharacter ])<br>
ifTrue: [<br>
self<br>
addString: (closers at: (openers indexOf: aKeyboardEvent keyCharacter)) asString;<br>
insertTypeAhead ;<br>
<br>
moveCursor: [ :position | position - 1 ]<br>
forward: false<br>
select: false ].<br>
^ result!<br>
<br>
<br>
</blockquote></div><br></div>