[squeak-dev] [5.2a] styled text in a class comment spawns endless subscript out-of-bounds

K K Subbu kksubbu.ml at gmail.com
Thu Jul 5 18:03:58 UTC 2018


Thank you very much for this lucid explanation. I have added it to

  http://wiki.squeak.org/squeak/2229 (ParagraphEditor)

Regards .. Subbu

On Thursday 05 July 2018 05:51 PM, Bob Arning wrote:
> It's good to remember what startIndex/startBlock/selectionStart and 
> stopIndex/stopBlock/selectionStop are used for. If you have a paragraph 
> with two characters 'ab'
> 
> ...and the 'a' is selected, then this is what the paragraph is thinking
> 
> selectionStart:     a CharacterBlock with index 1 and character $a and 
> rectangle 3 at 0 corner: 11 at 18.0
>   in a TextLine 1 to: 2
> selectionStop:     a CharacterBlock with index 2 and character $b and 
> rectangle 11 at 0 corner: 20 at 18.0
>   in a TextLine 1 to: 2
> 
> ...if the cursor is between 'a' and 'b' then this happens
> 
> selectionStart:     a CharacterBlock with index 2 and character $b and 
> rectangle 11 at 0 corner: 20 at 18.0
>   in a TextLine 1 to: 2
> selectionStop:     a CharacterBlock with index 2 and character $b and 
> rectangle 11 at 0 corner: 20 at 18.0
>   in a TextLine 1 to: 2
> 
> So, in the first case, it can highlight from the topLeft of 
> selectionStart to the bottomLeft of selectionStop. In the second case, 
> since the two are equal, it just displays the cursor along the left edge 
> of either.
> 
> In either case, the stopIndex is one more than last selected character and
> 
> selection
>      "Answer the text in the paragraph that is currently selected."
> 
>      ^paragraph text copyFrom: self startIndex to: self stopIndex - 1
> 
> returns the selected characters.


More information about the Squeak-dev mailing list