HaikuDepot: Try slightly harder to keep paragraphs together

* Some commented-out code to require two line-breaks to start a new
   paragraph. Doesn't work well with current set of packages.
 * If the character before a line-break is a space, do not start a new
   paragraph. Doesn't seem to occur in current package descriptions.
This commit is contained in:
Stephan Aßmus 2013-11-24 21:09:31 +01:00
parent 9fb4da1c9d
commit b7cb4587b0

View File

@ -137,7 +137,28 @@ MarkupParser::_ParseText(const BString& text)
uint32 nextChar = UTF8ToCharCode(&c); uint32 nextChar = UTF8ToCharCode(&c);
switch (nextChar) { switch (nextChar) {
// Requires two line-breaks to start a new paragraph, unles the current
// paragraph is already considered a bullet list item. Doesn't work well
// with current set of packages.
// case '\n':
// _CopySpan(text, start, offset);
// if (offset + 1 < charCount && c[0] == '\n') {
// _FinishParagraph();
// offset += 1;
// c += 1;
// } else if (fCurrentParagraph.Style() == fBulletStyle) {
// _FinishParagraph();
// }
// start = offset + 1;
// break;
case '\n': case '\n':
_CopySpan(text, start, offset);
if (offset > 0 && c[-1] != ' ')
_FinishParagraph();
start = offset + 1;
break;
case '\0': case '\0':
_CopySpan(text, start, offset); _CopySpan(text, start, offset);
_FinishParagraph(); _FinishParagraph();