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

commits at source.squeak.org commits at source.squeak.org
Sat Jul 14 17:44:50 UTC 2018


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

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

Name: Collections-kks.803
Author: kks
Time: 14 July 2018, 11:14:34.247017 pm
UUID: c6ea08ba-fcdd-46f8-89c0-c61d0d524531
Ancestors: Collections-dtl.802

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-dtl.802 ===============

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..."
+ 	aRunArray runs size = aRunArray values size ifFalse: [^ aString asText]. "raise error here?"
+ 	runsSize := aRunArray size.
+ 	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