[Pkg] The Trunk: Collections-kks.801.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jul 9 15:15:30 UTC 2018


Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-kks.801.mcz

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

Name: Collections-kks.801
Author: kks
Time: 9 July 2018, 8:20:57.318092 pm
UUID: ad558efb-0fea-41e7-9f20-ef7477b20704
Ancestors: Collections-ul.800

Attempt to retain as much styling as possible while filing in text from streams where the runs may fall short or extend beyond the string.

Based on Bob's suggestions at http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-July/199530.html

=============== Diff against Collections-ul.800 ===============

Item was changed:
  ----- Method: Text>>setString:setRunsChecking: (in category 'private') -----
  setString: aString setRunsChecking: aRunArray
+ 	| stringSize runsSize |
- 	"Check runs and do the best you can to make them fit..."
- 
  	string := aString.
- 	"check the runs"
  	aRunArray ifNil: [^ aString asText].
- 	(aRunArray isKindOf: RunArray) ifFalse: [^ aString asText].
- 	aRunArray runs size = aRunArray values size ifFalse: [^ aString asText].
- 	aRunArray size = aString size ifFalse: [^ aString asText].
  	
+ 	"Check runs and do the best you can to make them fit..."
+ 	runsSize := aRunArray runs size.
+ 	runsSize = aRunArray values size ifFalse: [^ aString asText]. "raise error here?"
+ 	stringSize := string size.
+ 	runs := stringSize = runsSize
+ 				ifTrue: [aRunArray]
+ 				ifFalse: [ stringSize > runsSize
+ 						ifTrue: [aRunArray  addLast: {} times: stringSize - runsSize]
+ 						ifFalse: [aRunArray copyFrom: 1 to: stringSize]].!
- 	runs := aRunArray.!



More information about the Packages mailing list