The Trunk: Morphic-ul.473.mcz

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

The Trunk: Morphic-ul.473.mcz

commits-2
Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.473.mcz

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

Name: Morphic-ul.473
Author: ul
Time: 12 November 2010, 3:45:16.93 am
UUID: dae64170-922a-644d-92b0-fa516b4ee902
Ancestors: Morphic-ul.472

- enh: added special #blinkPrevParen: for SmalltalkEditor
- deprecated TextEditor >> #blinkPrevParen, because it's not used anymore

=============== Diff against Morphic-ul.472 ===============

Item was added:
+ ----- Method: SmalltalkEditor>>blinkPrevParen: (in category 'parenblinking') -----
+ blinkPrevParen: aCharacter
+ "Same as super, but tries to follow the Smalltalk syntax."
+
+ | openDelimiter closeDelimiter level string here inside |
+ string := paragraph text string.
+ here := pointBlock stringIndex.
+ openDelimiter := aCharacter.
+ closeDelimiter := '([{' at: (')]}' indexOf: openDelimiter).
+ level := 1.
+ inside := nil. "Tricky."
+ (here > 1 and: [ (string at: here - 1) = $$ ]) ifTrue: [ ^self ]. "Just a character literal."
+ [ level > 0 and: [ here > 1 ] ] whileTrue: [
+ | hereChar |
+ hereChar := string at: (here := here - 1).
+ inside "Are we inside a comment or string literal?"
+ ifNotNil: [ "Yes."
+ hereChar = inside ifTrue: [
+ (here > 1 and: [ (string at: here - 1) ~= inside ])
+ ifTrue: [ inside := nil ]
+ ifFalse: [ here := here - 1 ] ] ]
+ ifNil: [
+ (here > 1 and: [ (string at: here - 1) = $$ ]) "Just a character literal."
+ ifTrue: [ here := here - 1 ]
+ ifFalse: [
+ hereChar
+ caseOf: {
+ [ closeDelimiter ] -> [
+ (level := level - 1) = 0 ifTrue: [
+ ^self blinkParenAt: here ] ].
+ [ openDelimiter ] -> [  level := level + 1 ].
+ [ $" ] -> [ inside := $" ].
+ [ $' ] -> [ inside := $' ] }
+ otherwise: [] ] ] ]!

Item was changed:
  ----- Method: TextEditor>>blinkPrevParen (in category 'parenblinking') -----
  blinkPrevParen
 
+ self deprecated: 'Use #blinkPrevParen:'.
  self blinkPrevParen: sensor keyboardPeek!