[squeak-dev] The Trunk: Morphic-dtl.1358.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Nov 11 00:39:13 UTC 2017


David T. Lewis uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-dtl.1358.mcz

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

Name: Morphic-dtl.1358
Author: dtl
Time: 10 November 2017, 7:39:02.562749 pm
UUID: c99ed855-5b48-48ff-827a-c1a6e87cd1e6
Ancestors: Morphic-tpr.1357

Yellow button menu for a workspace generally acts upon the text selection, not the full workspace text. Make it so for pretty printing the selected text in a workspace.

=============== Diff against Morphic-tpr.1357 ===============

Item was changed:
  ----- Method: TextEditor>>prettyPrint: (in category 'menu messages') -----
  prettyPrint: decorated 
  	"Reformat the contents of the receiver's view (a Browser or Workspace)."
  
+ 	model selectedClassOrMetaClass
+ 		ifNil: [ "arbitrary text selection in a workspace, not directly associated with a class"
+ 			(Compiler new formatNoPattern: self selection environment: model environment)
+ 				ifNotNilDo: [:newText | self replaceSelectionWith: newText]]
+ 		ifNotNil: [:selectedClass | "source for a method in the selected class"
+ 			(selectedClass newCompiler
+ 					format: self text
+ 					in: selectedClass
+ 					notifying: self
+ 					decorated: decorated)
+ 				ifNotNilDo: [ :newText |
+ 						self deselect; selectInvisiblyFrom: 1 to: paragraph text size.
+ 						self replaceSelectionWith: (selectedClass ifNil: [newText] ifNotNil: [newText asText makeSelectorBoldIn: selectedClass]).
+ 						self selectAt: self text size + 1 ]].
+ !
- 	| selectedClass newText |
- 	selectedClass := model selectedClassOrMetaClass.
- 	newText := selectedClass
- 		ifNil: [ 
- 			Compiler new
- 				formatNoPattern: self text
- 				environment: model environment ]
- 		ifNotNil: [:cls |
- 			selectedClass newCompiler
- 				format: self text
- 				in: cls
- 				notifying: self
- 				decorated: decorated ].
- 	newText ifNotNil:
- 		[ self
- 			deselect ;
- 			selectInvisiblyFrom: 1
- 			to: paragraph text size.
- 		self replaceSelectionWith: (selectedClass ifNil: [newText] ifNotNil: [newText asText makeSelectorBoldIn: selectedClass]).
- 		self selectAt: self text size + 1 ]!



More information about the Squeak-dev mailing list