[squeak-dev] The Inbox: Collections-kks.798.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jul 6 09:50:22 UTC 2018


A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-kks.798.mcz

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

Name: Collections-kks.798
Author: kks
Time: 6 July 2018, 3:20:06.403752 pm
UUID: 151011b4-ef92-409b-9078-bdd1be01ce87
Ancestors: Collections-cmm.797

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-cmm.797 ===============

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 Squeak-dev mailing list