From f429142df9d4e2a3c3d8345824919a29d6662ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Mon, 27 Jan 2014 10:41:33 +0100 Subject: [PATCH] Paragraph::Remove() Keep last remaining span as empty span. --- src/apps/haiku-depot/textview/Paragraph.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/apps/haiku-depot/textview/Paragraph.cpp b/src/apps/haiku-depot/textview/Paragraph.cpp index 0409e55ab3..db6ea8a388 100644 --- a/src/apps/haiku-depot/textview/Paragraph.cpp +++ b/src/apps/haiku-depot/textview/Paragraph.cpp @@ -203,9 +203,10 @@ Paragraph::Remove(int32 offset, int32 length) } } - // See if anything from the TextSpan at offset remained + // See if anything from the TextSpan at offset remained, keep it as empty + // span if it is the last remaining span. index--; - if (span.CountChars() > 0) { + if (span.CountChars() > 0 || fTextSpans.CountItems() == 1) { fTextSpans.Replace(index, span); } else { fTextSpans.Remove(index);