[squeak-dev] The Trunk: ShoutCore-nice.32.mcz

commits at source.squeak.org commits at source.squeak.org
Sun May 8 11:32:05 UTC 2011


Nicolas Cellier uploaded a new version of ShoutCore to project The Trunk:
http://source.squeak.org/trunk/ShoutCore-nice.32.mcz

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

Name: ShoutCore-nice.32
Author: nice
Time: 8 May 2011, 1:31:53.314 pm
UUID: de8914c7-3f4b-4570-a0b5-728b936de54a
Ancestors: ShoutCore-ul.31

minor refactorings: use #anySatisfy: #allSatisfy: #noneSatisfy: where it simplifies

=============== Diff against ShoutCore-ul.31 ===============

Item was changed:
  ----- Method: SHTextStylerST80>>setAttributesIn:fromRanges: (in category 'private') -----
  setAttributesIn: aText fromRanges: ranges
  	| charAttr defaultAttr attr newRuns newValues lastAttr oldRuns lastCount | 		
  		
  	oldRuns := aText runs.
  	defaultAttr := self attributesFor: #default.
  	charAttr := Array new: aText size.
  	1 to: charAttr size do: [:i | charAttr at: i put: defaultAttr].
  	ranges do: [:range |
  		(attr := self attributesFor: range type) == nil
  			ifFalse:[	range start to: range end do: [:i | charAttr at: i put: attr]]].
  	newRuns := OrderedCollection new: charAttr size // 10.
  	newValues := OrderedCollection new: charAttr size // 10.
  	1 to: charAttr size do: [:i |
  		attr := charAttr at: i.
  		i = 1 
  			ifTrue: [
  				newRuns add: 1.
  				lastCount := 1.
  				lastAttr := newValues add: attr]
  			ifFalse:[
  				attr == lastAttr
  					ifTrue: [
  						lastCount := lastCount + 1.
  						newRuns at: newRuns size put: lastCount]
  					ifFalse: [
  						newRuns add: 1.
  						lastCount := 1.
  						lastAttr := newValues add: attr]]].	
  	aText runs: (RunArray runs: newRuns values: newValues).
  	oldRuns withStartStopAndValueDo:[:start :stop :attribs|
+ 		(attribs anySatisfy: [:each | self shouldPreserveAttribute: each])
+ 			ifTrue: [
- 		(attribs detect: [:each | self shouldPreserveAttribute: each] ifNone:[nil]) == nil
- 			ifFalse: [
  				attribs do: [:eachAttrib | aText addAttribute: eachAttrib from: start to: stop]]].
  	!

Item was changed:
  ----- Method: SHTextStylerST80>>unstyledTextFrom: (in category 'converting') -----
  unstyledTextFrom: aText
  	"Re-implemented so that TextActions are not removed from aText"
  	| answer |	
  	answer := super unstyledTextFrom: aText.
+ 	aText runs withStartStopAndValueDo: [:start :stop :attribs |
+ 		(attribs anySatisfy: [:each | each isKindOf: TextAction])
+ 			ifTrue: [
- 	aText runs withStartStopAndValueDo:[:start :stop :attribs|
- 		(attribs detect: [:each | each isKindOf: TextAction] ifNone:[nil])
- 			ifNotNil:[
  				attribs do: [:eachAttrib | answer addAttribute: eachAttrib from: start to: stop]]].
  	^answer!




More information about the Squeak-dev mailing list