[Pkg] The Trunk: Morphic-ul.472.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Nov 12 15:44:27 UTC 2010


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

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

Name: Morphic-ul.472
Author: ul
Time: 12 November 2010, 2:07:59.142 am
UUID: 4b75bbb1-154b-dc4e-a09c-d00134f03b5b
Ancestors: Morphic-ul.471

- fix for http://bugs.squeak.org/view.php?id=1005
- fix: if the opening bracket was the first character in the text editor, then it wasn't highlighted

=============== Diff against Morphic-ul.471 ===============

Item was changed:
  ----- 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 > 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: TextEditor>>dispatchOnCharacter:with: (in category 'typing support') -----
  dispatchOnCharacter: char with: typeAheadStream
  	"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 |
  	((char == Character cr) and: [morph acceptOnCR])
  		ifTrue: [
  			sensor keyboard.  "Gobble cr -- probably unnecessary."
  			self closeTypeIn.
  			^ true].
  
  	self clearParens.
    
  	char asciiValue = 13 ifTrue: [
  		sensor controlKeyPressed ifTrue: [
  			^ self normalCharacter: typeAheadStream ].
  		sensor leftShiftDown ifTrue: [
  			^ self lf: typeAheadStream ].
  		sensor commandKeyPressed ifTrue: [
  			^ self crlf: typeAheadStream ].
  		^ self crWithIndent: typeAheadStream ].
  
  	((honorCommandKeys := Preferences cmdKeysInText) and: [char = Character enter])
  		ifTrue: [^ self dispatchOnEnterWith: typeAheadStream].
  
  	"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: char asciiValue) and: [char asciiValue < 27])
  		ifTrue: [^ sensor controlKeyPressed
  			ifTrue: [self perform: (self class shiftCmdActions at: char asciiValue + 1) with: typeAheadStream]
  			ifFalse: [self perform: (self class cmdActions at: char asciiValue + 1) with: typeAheadStream]].
  
  	"backspace, and escape keys (ascii 8 and 27) are command keys"
  	((honorCommandKeys and: [sensor commandKeyPressed]) or: [self class specialShiftCmdKeys includes: char asciiValue]) ifTrue:
  		[^ sensor leftShiftDown
  			ifTrue: [
  				self perform: (self class shiftCmdActions at: char asciiValue + 1) with: typeAheadStream]
  			ifFalse: [
  				self perform: (self class cmdActions at: char asciiValue + 1) with: typeAheadStream]].
  
  	"the control key can be used to invoke shift-cmd shortcuts"
  	(honorCommandKeys and: [sensor controlKeyPressed])
  		ifTrue: [
  			^ self perform: (self class shiftCmdActions at: char asciiValue + 1) with: typeAheadStream].
  
  	openers := '([{'.  closers := ')]}'.
- 	(closers includes: char) ifTrue: [self blinkPrevParen].
  
  	result := self normalCharacter: typeAheadStream.
+ 	(closers includes: char) ifTrue: [self blinkPrevParen: char].
  
  	(self class autoEnclose and: [ openers includes: char ])
  		ifTrue: 
  			[ typeAheadStream nextPut: (closers at: (openers indexOf: char)).
  			self insertTypeAhead: typeAheadStream.
  			self moveCursor: [ : position | position-1 ] forward: false specialBlock: [ : pos | "no special behavior" ] select: false ].
  
  	^ result!



More information about the Packages mailing list