From 22626dc027c900ed13da3bda199f80d081fc0887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Mon, 20 Jan 2014 00:49:14 +0100 Subject: [PATCH] TextDocument::Insert() fixed line break case. * Always add back the second part of the split paragraph, even if it has a length of 0. --- src/apps/haiku-depot/textview/TextDocument.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/apps/haiku-depot/textview/TextDocument.cpp b/src/apps/haiku-depot/textview/TextDocument.cpp index d29c423683..7b9a13d5c1 100644 --- a/src/apps/haiku-depot/textview/TextDocument.cpp +++ b/src/apps/haiku-depot/textview/TextDocument.cpp @@ -149,15 +149,13 @@ TextDocument::Insert(int32 textOffset, const BString& text, } else { if (!paragraph2.Prepend(span)) return B_NO_MEMORY; - if (paragraph2.Length() > 0) { - if (!fParagraphs.Add(paragraph2, index)) - return B_NO_MEMORY; - index++; - } } chunkStart = chunkEnd + 1; } + + if (!fParagraphs.Add(paragraph2, index)) + return B_NO_MEMORY; } else { Paragraph paragraph(ParagraphAt(index)); paragraph.Insert(textOffset, TextSpan(text, characterStyle));