[squeak-dev] The Trunk: ShoutCore-ul.58.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Mar 13 15:00:13 UTC 2017
Levente Uzonyi uploaded a new version of ShoutCore to project The Trunk:
http://source.squeak.org/trunk/ShoutCore-ul.58.mcz
==================== Summary ====================
Name: ShoutCore-ul.58
Author: ul
Time: 13 March 2017, 2:56:26.63928 pm
UUID: 8bcf6f78-fd6f-4e44-a67c-56260f0bb0e8
Ancestors: ShoutCore-mt.57
SortedCollection Whack-a-mole
=============== Diff against ShoutCore-mt.57 ===============
Item was changed:
----- Method: SHTextStylerST80>>replaceStringForRangesWithType:with:in: (in category 'private') -----
replaceStringForRangesWithType: aSymbol with: aString in: aText
"Answer aText if no replacements, or a copy of aText with
each range with a type of aSymbol replaced by aString"
| answer toReplace adjustSourceMap increaseInLength |
+ toReplace := self rangesIn: aText setWorkspace: false.
+ toReplace removeAllSuchThat: [ :each | each type ~~ aSymbol ].
- toReplace := (self rangesIn: aText setWorkspace: false)
- select: [:each | each type = aSymbol].
toReplace isEmpty ifTrue: [^aText].
answer := aText copy.
increaseInLength := 0.
adjustSourceMap := sourceMap notNil and:[sourceMap ~~ processedSourceMap].
+ toReplace
+ sort: [:a :b | a start <= b start];
- (toReplace asSortedCollection: [:a :b | a start <= b start])
do: [:each | | end start thisIncrease |
start := each start + increaseInLength.
end := each end + increaseInLength.
answer replaceFrom: start to: end with: aString.
thisIncrease := aString size - each length.
increaseInLength := increaseInLength + thisIncrease.
adjustSourceMap ifTrue:[
sourceMap do:[:assoc | | first newFirst last newLast |
first := newFirst := assoc value first.
last := newLast := assoc value last.
first > start ifTrue:[newFirst := first + thisIncrease].
last > start ifTrue:[newLast := last + thisIncrease].
(first ~= newFirst or:[last ~= newLast])
ifTrue:[assoc value: (newFirst to: newLast)]]]].
adjustSourceMap ifTrue:[processedSourceMap := sourceMap].
^answer!
More information about the Squeak-dev
mailing list
|