[squeak-dev] The Trunk: Morphic-eem.617.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Apr 8 22:32:25 UTC 2012


Eliot Miranda uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-eem.617.mcz

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

Name: Morphic-eem.617
Author: eem
Time: 8 April 2012, 3:30:59.972 pm
UUID: a9d994a9-3d4f-4654-aebe-9664fc07f4e2
Ancestors: Morphic-cwp.616

Hack fix for shift-enclose-' which at least gives enclose for
the comment character ".  But still no shift-enclose for
| (which maybe shifted \) or < (which may be shifted ,).

=============== Diff against Morphic-cwp.616 ===============

Item was changed:
  ----- Method: TextEditor>>enclose: (in category 'editing keys') -----
  enclose: aKeyboardEvent
  	"Insert or remove bracket characters around the current selection."
  
+ 	| character left right startIndex stopIndex oldSelection which t |
+ 	character := aKeyboardEvent shiftPressed
+ 					ifTrue: ['{}|"<>' at: ('[]\'',.' indexOf: aKeyboardEvent keyCharacter) ifAbsent: [aKeyboardEvent keyCharacter]]
+ 					ifFalse: [aKeyboardEvent keyCharacter].
- 	| left right startIndex stopIndex oldSelection which t |
  	self closeTypeIn.
  	startIndex := self startIndex.
  	stopIndex := self stopIndex.
  	oldSelection := self selection.
+ 	which := '([<{|"''9' indexOf: character ifAbsent: [ ^true ].
- 	which := '([<{|"''9' indexOf: aKeyboardEvent keyCharacter ifAbsent: [ ^true ].
  	"Allow Control key in lieu of Alt+Shift for (, {, and double-quote."
  	left := ((Preferences cmdKeysInText and: [ aKeyboardEvent controlKeyPressed ])
  		ifTrue: [ '({<{|""(' ]
  		ifFalse: ['([<{|"''(']) at: which.
  	right := ((Preferences cmdKeysInText and: [ aKeyboardEvent controlKeyPressed ])
  		ifTrue: [ ')}>}|"")' ] 
  		ifFalse: [')]>}|"'')']) at: which.
  	t := self text.
  	((startIndex > 1 and: [stopIndex <= t size])
  			and: [ (t at: startIndex-1) = left and: [(t at: stopIndex) = right]])
  		ifTrue: [
  			"already enclosed; strip off brackets"
  			self selectFrom: startIndex-1 to: stopIndex.
  			self replaceSelectionWith: oldSelection]
  		ifFalse: [
  			"not enclosed; enclose by matching brackets"
  			self replaceSelectionWith:
  				(Text string: (String with: left), oldSelection string, (String with: right) attributes: emphasisHere).
  			self selectFrom: startIndex+1 to: stopIndex].
  	^true!



More information about the Squeak-dev mailing list