TextDocument::Insert() fixed line break case.
* Always add back the second part of the split paragraph, even if it has a length of 0.
This commit is contained in:
@@ -149,15 +149,13 @@ TextDocument::Insert(int32 textOffset, const BString& text,
|
|||||||
} else {
|
} else {
|
||||||
if (!paragraph2.Prepend(span))
|
if (!paragraph2.Prepend(span))
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
if (paragraph2.Length() > 0) {
|
|
||||||
if (!fParagraphs.Add(paragraph2, index))
|
|
||||||
return B_NO_MEMORY;
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chunkStart = chunkEnd + 1;
|
chunkStart = chunkEnd + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fParagraphs.Add(paragraph2, index))
|
||||||
|
return B_NO_MEMORY;
|
||||||
} else {
|
} else {
|
||||||
Paragraph paragraph(ParagraphAt(index));
|
Paragraph paragraph(ParagraphAt(index));
|
||||||
paragraph.Insert(textOffset, TextSpan(text, characterStyle));
|
paragraph.Insert(textOffset, TextSpan(text, characterStyle));
|
||||||
|
|||||||
Reference in New Issue
Block a user