Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.986.mcz ==================== Summary ==================== Name: Morphic-cmm.986 Author: cmm Time: 29 May 2015, 4:07:48.693 pm UUID: a448eb5a-ab1f-4acc-9c76-ebdaac144d58 Ancestors: Morphic-cmm.984, Morphic-mt.985 - Merged cmm.984. - Auto Enclose fixes. =============== Diff against Morphic-mt.985 =============== Item was changed: ----- Method: Morph>>handlesMouseMove: (in category 'event handling') ----- handlesMouseMove: anEvent "Do I want to receive mouseMove: when the hand passes over the receiver? Rules say that by default a morph gets #mouseMove iff * the hand is not dragging anything, + and some button is down, + and the receiver is the current mouse focus." + self eventHandler ifNotNil: [^ self eventHandler handlesMouseMove: anEvent]. anEvent hand hasSubmorphs ifTrue: [ ^ false ]. (anEvent anyButtonPressed and: [ anEvent hand mouseFocus == self ]) ifFalse: [ ^ false ]. ^ true! Item was added: + ----- Method: TextEditor>>autoEncloseFor: (in category 'typing support') ----- + autoEncloseFor: typedChar + "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." + | openers closers | + openers := '([{'. + closers := ')]}'. + (closers includes: typedChar) + ifTrue: + [ | pos | + self blinkPrevParen: typedChar. + ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) + ifTrue: + [ (paragraph string at: pos) = typedChar ifTrue: + [ self + moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] + forward: true + select: false ]. + ^ true ] + ifFalse: [ ^ false ] ]. + (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. + ^ false ]. + ^ false! 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 typedChar | - | 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 ]. + self class autoEnclose + ifTrue: [ (self autoEncloseFor: typedChar) ifFalse: [ self normalCharacter: aKeyboardEvent ] ] + ifFalse: [ self normalCharacter: aKeyboardEvent ]. + ^ false! - 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! Item was added: + ----- Method: TextEditor>>indexOfNextNonwhitespaceCharacter (in category 'private') ----- + indexOfNextNonwhitespaceCharacter + pointBlock stringIndex + to: paragraph string size + do: + [ : n | | char | (char := paragraph string at: n) isSeparator ifFalse: [ ^ n ] ]. + ^ nil! Item was removed: - ----- 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! |
Free forum by Nabble | Edit this page |