Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-nice.229.mcz==================== Summary ====================
Name: Morphic-nice.229
Author: nice
Time: 16 November 2009, 5:55:04 am
UUID: 4352eef2-9e1e-1749-979a-46c61cc63f22
Ancestors: Morphic-dtl.228
Handle more crlf cases
=============== Diff against Morphic-dtl.228 ===============
Item was changed:
----- Method: Editor>>lines (in category 'private') -----
lines
"Compute lines based on logical line breaks, not optical (which may change due to line wrapping of the editor).
Subclasses using kinds of Paragraphs can instead use the service provided by it.
"
| lines string index lineIndex stringSize |
+ string := self string.
- string _ self string.
"Empty strings have no lines at all. Think of something."
string isEmpty ifTrue:[^{#(1 0 0)}].
+ stringSize := string size.
+ lines := OrderedCollection new: (string size // 15).
+ index := 0.
+ lineIndex := 0.
- stringSize _ string size.
- lines _ OrderedCollection new: (string size // 15).
- index _ 0.
- lineIndex _ 0.
string linesDo:[:line |
lines addLast: (Array
+ with: (index := index + 1)
+ with: (lineIndex := lineIndex + 1)
+ with: (index := index + line size min: stringSize))].
- with: (index _ index + 1)
- with: (lineIndex _ lineIndex + 1)
- with: (index _ index + line size min: stringSize))].
"Special workaround for last line empty."
+ (string last == Character cr or: [string last == Character lf])
- string last == Character cr
"lines last last < stringSize" ifTrue:[lines addLast:{stringSize +1. lineIndex+1. stringSize}].
^lines!