Marcel Taeumel uploaded a new version of Morphic to project The Trunk: http://source.squeak.org/trunk/Morphic-mt.2089.mcz
==================== Summary ====================
Name: Morphic-mt.2089 Author: mt Time: 22 February 2023, 4:35:56.19355 pm UUID: 4c37a955-4f22-4e42-84a2-9c051554c713 Ancestors: Morphic-mt.2088
Fixes conversion from paragraph to text (incl. hard line-breaks), which had a bug for trailing-CR lines.
=============== Diff against Morphic-mt.2088 ===============
Item was changed: ----- Method: NewParagraph>>asTextWithLineBreaks (in category 'converting') ----- asTextWithLineBreaks "Answer a text that has all soft line breaks converted to hard line breaks. Add the current style's default font as a text attribute only if a) the style is not the default and b) the first character has no other font set. See Text >> #asTextMorph."
| result | result := Text streamContents: [:s | lines do: [:textLine | + textLine last >= textLine first "ignore extra trailing-CR line" ifTrue: [ + | lastChar lastIndex break | + lastChar := text at: textLine last. + (break := CharacterSet separators includes: lastChar) + ifTrue: [lastIndex := textLine last - 1] + ifFalse: [lastIndex := textLine last]. + "1) Copy text line, which may be due to a soft line break" + s nextPutAll: (text copyFrom: textLine first to: lastIndex). + "2) Add a hard line break." + break ifTrue: [s nextPutAll: (String cr asText + addAllAttributes: (text attributesAt: textLine last); + yourself)]]]]. - | lastChar lastIndex break | - lastChar := text at: textLine last. - (break := CharacterSet separators includes: lastChar) - ifTrue: [lastIndex := textLine last - 1] - ifFalse: [lastIndex := textLine last]. - "1) Copy text line, which may be due to a soft line break" - s nextPutAll: (text copyFrom: textLine first to: lastIndex). - "2) Add a hard line break." - break ifTrue: [s nextPutAll: (String cr asText - addAllAttributes: (text attributesAt: textLine last); - yourself)]]]. ((text fontAt: 1 withDefault: nil) isNil and: [ textStyle defaultFamilyName ~= TextStyle default defaultFamilyName]) ifTrue: [result addAttribute: (TextFontReference toFont: textStyle defaultFont)].
^ result!
packages@lists.squeakfoundation.org