[squeak-dev] The Trunk: Morphic-mt.1801.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Nov 25 10:51:33 UTC 2021


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1801.mcz

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

Name: Morphic-mt.1801
Author: mt
Time: 25 November 2021, 11:51:27.763354 am
UUID: feacc293-41b9-5940-8615-d5bf4ce5a91a
Ancestors: Morphic-mt.1800

Complements Tools-mt.1075

=============== Diff against Morphic-mt.1800 ===============

Item was changed:
  ----- Method: TextEditor>>saveContentsInFile (in category 'menu messages') -----
  saveContentsInFile
+ 	"Save the receiver's contents string to a file, which usually prompts the user for a file name."
- 	"Save the receiver's contents string to a file, prompting the user for a file-name.  Suggest a reasonable file-name."
  
+ 	self paragraph text string
+ 		ifEmpty: [self inform: 'Nothing to save.']
+ 		ifNotEmpty: [:stringToSave |
+ 			(self model saveContents: stringToSave accessMode: #create)
+ 				ifTrue: [
+ 					self flag: #discuss. "mt: Is this correct? Having unaccepted contents means that the model does not know about it. Do we assume that the model will also keep track of the stringToSave?"
+ 					self morph hasUnacceptedEdits: false]].!
- 	| stringToSave parentWindow labelToUse suggestedName fileName |
- 	(stringToSave := paragraph text string) isEmpty ifTrue:
- 		[^self inform: 'nothing to save.'].
- 	parentWindow := model dependents
- 						detect: [:dep | dep isSystemWindow]
- 						ifNone: [self error: 'could not find parent window'].
- 	labelToUse := (parentWindow valueOfProperty: #myDir)
- 					ifNil: [parentWindow label]
- 					ifNotNil: [:dir| dir fullNameFor: parentWindow label].
- 	suggestedName := nil.
- 	"can add more here..."
- 	#(('Decompressed contents of: ' '.gz')) do:
- 		[:pair |
- 		[:leader :trailer|
- 		(labelToUse beginsWith: leader) ifTrue:
- 			[suggestedName := labelToUse allButFirst: leader size.
- 			(labelToUse endsWith: trailer)
- 				ifTrue:
- 					[suggestedName := suggestedName allButLast: trailer size]
- 				ifFalse:
- 					[| lastIndex |
- 					 lastIndex := suggestedName lastIndexOf: $. ifAbsent: [0].
- 					 lastIndex > 1 ifTrue:
- 						[suggestedName := suggestedName copyFrom: 1 to: lastIndex - 1]]]]
- 			valueWithArguments: pair].
- 	suggestedName ifNil:
- 		[suggestedName := (labelToUse includes: $.)
- 								ifTrue: [labelToUse]
- 								 ifFalse: [labelToUse, '.text']].
- 	fileName := UIManager default request: 'File name?' initialAnswer: suggestedName.
- 	fileName isEmptyOrNil ifTrue: [^self].
- 	((MultiByteFileStream newFileNamed: fileName)
- 		lineEndConvention: (parentWindow valueOfProperty: #lineConversion); "nil is fine here..."
- 		nextPutAll: stringToSave;
- 		close;
- 		directory) ifNotNil:
- 			[:dir|
- 			dir = FileDirectory default
- 				ifTrue: [parentWindow removeProperty: #myDir]
- 				ifFalse: [parentWindow setProperty: #myDir toValue: dir].
- 			fileName := dir localNameFor: fileName].
- 	suggestedName ~= fileName ifTrue:
- 		[parentWindow label: ((fileName endsWith: '.text') ifTrue: [fileName allButLast: 5] ifFalse: [fileName])].
-   	self morph hasUnacceptedEdits: false!



More information about the Squeak-dev mailing list