=============== Diff against Morphic-mt.1563 ===============
Item was changed:
----- Method: TextMorph>>updateFromParagraph (in category 'private') -----
"A change has taken place in my paragraph, as a result of editing and I must be updated. If a line break causes recomposition of the current paragraph, or it the selection has entered a different paragraph, then the current editor will be released, and must be reinstalled with the resulting new paragraph, while retaining any editor state, such as selection, undo state, and current typing emphasis."
| newStyle sel oldLast oldEditor back |
paragraph ifNil: [^self].
wrapFlag ifNil: [wrapFlag := true].
[oldEditor := editor.
sel := editor selectionInterval.
text := paragraph text.
paragraph textStyle = textStyle
ifTrue: [self fit]
["Broadcast style changes to all morphs"
"If selection is in top line, then recompose predecessor for possible ripple-back"
[sel first <= (self paragraph lines first last + 1)
[oldLast := predecessor lastCharacterIndex.
to: text size
oldLast = predecessor lastCharacterIndex
[predecessor changed. "really only last line"
((back := predecessor notNil
and: [sel first <= self paragraph firstCharacterIndex]) or:
and: [sel first > (self paragraph lastCharacterIndex + 1)]])
["The selection is no longer inside this paragraph.
Pass focus to the paragraph that should be in control."
back ifTrue: [predecessor recomposeChain] ifFalse: [self recomposeChain].
self firstInChain withSuccessorsDo:
(sel first between: m firstCharacterIndex and: m lastCharacterIndex + 1)
[m installEditorToReplace: oldEditor.
^self passKeyboardFocusTo: m]].
self error: 'Inconsistency in text editor' "Must be somewhere in the successor chain"].
["Reinstate selection after, eg, style change"