TextDocument: Extended comment in _Insert().

This commit is contained in:
Stephan Aßmus 2015-09-20 22:18:10 +02:00
parent f890fab65b
commit 5f80d48a76
1 changed files with 3 additions and 1 deletions

View File

@ -545,7 +545,9 @@ TextDocument::_Insert(int32 textOffset, TextDocumentRef document,
// Insert back the second paragraph-part
if (paragraph2.IsEmpty()) {
// Make sure Paragraph has at least one TextSpan, even
// if its empty.
// if its empty. This handles the case of inserting a
// line-break at the end of the document. It than needs to
// have a new, empty paragraph at the end.
const TextSpanList& spans = paragraph1.TextSpans();
const TextSpan& span = spans.LastItem();
if (!paragraph2.Append(TextSpan("", span.Style())))