The Trunk: Collections-dtl.802.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-dtl.802.mcz

commits-2
David T. Lewis uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-dtl.802.mcz

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

Name: Collections-dtl.802
Author: dtl
Time: 19 July 2018, 12:40:11.186143 am
UUID: 95497d30-f52f-4f82-ac8c-3e65cfa30df1
Ancestors: Collections-cmm.801

Change Text class>>string:runs: to call setString:setRunsChecking: instead of setString:setRuns: to prevent creating a Text with run length not matching string length. This fixes the problem originally reported by Tim Johnson in http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-July/199461.html

Add patch by K K Subbu to fix instantiating text when the string and the runarray are of mismatched lengths. This allows a filein to retain text attributes even if the runarray does not match the string length, as may be the case for a fileIn that had been edited externally (otherwise the text will be converted to a string without the intended attributes).

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

Item was changed:
  ----- Method: Text class>>string:runs: (in category 'private') -----
  string: aString runs: anArray
   
+ ^self basicNew setString: aString setRunsChecking: anArray!
- ^self basicNew setString: aString setRuns: anArray!

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.!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-dtl.802.mcz

David T. Lewis
This is the update from Collections-kks.803, with a change to Text class>>string:runs:
to ensure that the runs check is done. I moved Collections-kks.803 from inbox
to treated inbox.

Dave

On Thu, Jul 19, 2018 at 04:44:57AM +0000, [hidden email] wrote:

> David T. Lewis uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-dtl.802.mcz
>
> ==================== Summary ====================
>
> Name: Collections-dtl.802
> Author: dtl
> Time: 19 July 2018, 12:40:11.186143 am
> UUID: 95497d30-f52f-4f82-ac8c-3e65cfa30df1
> Ancestors: Collections-cmm.801
>
> Change Text class>>string:runs: to call setString:setRunsChecking: instead of setString:setRuns: to prevent creating a Text with run length not matching string length. This fixes the problem originally reported by Tim Johnson in http://lists.squeakfoundation.org/pipermail/squeak-dev/2018-July/199461.html
>
> Add patch by K K Subbu to fix instantiating text when the string and the runarray are of mismatched lengths. This allows a filein to retain text attributes even if the runarray does not match the string length, as may be the case for a fileIn that had been edited externally (otherwise the text will be converted to a string without the intended attributes).
>
> 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-cmm.801 ===============
>
> Item was changed:
>   ----- Method: Text class>>string:runs: (in category 'private') -----
>   string: aString runs: anArray
>    
> + ^self basicNew setString: aString setRunsChecking: anArray!
> - ^self basicNew setString: aString setRuns: anArray!
>
> 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.!
>
>