Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.471.mcz ==================== Summary ==================== Name: Morphic-ul.471 Author: ul Time: 27 October 2010, 4:10:29.885 am UUID: 4b5b5062-6173-234b-8895-029389451407 Ancestors: Morphic-eem.470 - integration of the code completion hook to TextMorph >> #keyStroke: using ToolSet - added TextEditor >> #blinkPrevParen: for compatibility with code completion tools - TextEditor >> #blinkPrevParen uses #blinkPrevParen: =============== Diff against Morphic-eem.470 =============== Item was changed: ----- Method: TextEditor>>blinkPrevParen (in category 'parenblinking') ----- blinkPrevParen + + self blinkPrevParen: sensor keyboardPeek! - | openDelimiter closeDelimiter level string here hereChar | - string := paragraph text string. - here := pointBlock stringIndex. - openDelimiter := sensor keyboardPeek. - closeDelimiter := '([{' at: (')]}' indexOf: openDelimiter). - level := 1. - [level > 0 and: [here > 2]] - whileTrue: - [hereChar := string at: (here := here - 1). - hereChar = closeDelimiter - ifTrue: - [level := level - 1. - level = 0 - ifTrue: [^ self blinkParenAt: here]] - ifFalse: - [hereChar = openDelimiter - ifTrue: [level := level + 1]]]! Item was added: + ----- Method: TextEditor>>blinkPrevParen: (in category 'parenblinking') ----- + blinkPrevParen: aCharacter + + | openDelimiter closeDelimiter level string here hereChar | + string := paragraph text string. + here := pointBlock stringIndex. + openDelimiter := aCharacter. + closeDelimiter := '([{' at: (')]}' indexOf: openDelimiter). + level := 1. + [level > 0 and: [here > 2]] + whileTrue: + [hereChar := string at: (here := here - 1). + hereChar = closeDelimiter + ifTrue: + [level := level - 1. + level = 0 + ifTrue: [^ self blinkParenAt: here]] + ifFalse: + [hereChar = openDelimiter + ifTrue: [level := level + 1]]]! Item was changed: ----- Method: TextMorph>>keyStroke: (in category 'event handling') ----- keyStroke: evt "Handle a keystroke event." self resetBlinkCursor. "don't blink during type-in" + ToolSet + codeCompletionAround: [ + evt keyValue = 13 ifTrue: [ "CR - check for special action" + self crAction ifNotNil: [ :action | + "Note: Code below assumes that this was some + input field reacting on CR. Break the keyboard + focus so that the receiver can be safely deleted." + evt hand newKeyboardFocus: nil. + ^action valueWithEnoughArguments: { evt } ] ]. + self handleInteraction: [ editor readKeyboard ] fromEvent: evt. + "self updateFromParagraph." + super keyStroke: evt "sends to keyStroke event handler, if any" ] + textMorph: self + keyStroke: evt! - evt keyValue = 13 ifTrue: [ "CR - check for special action" - self crAction ifNotNil: [ :action | - "Note: Code below assumes that this was some - input field reacting on CR. Break the keyboard - focus so that the receiver can be safely deleted." - evt hand newKeyboardFocus: nil. - ^action valueWithEnoughArguments: { evt } ] ]. - self handleInteraction: [ editor readKeyboard ] fromEvent: evt. - "self updateFromParagraph." - super keyStroke: evt "sends to keyStroke event handler, if any"! |
Free forum by Nabble | Edit this page |