hrev46432 adds 2 changesets to branch 'master' old head: f3c471f44cc64ccc015053acdd8afb0e1fb55d71 new head: b7cb4587b0a2664d9ad9bd8cb262bf78ad2f1bef overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=b7cb458+%5Ef3c471f ---------------------------------------------------------------------------- 9fb4da1: HaikuDepot: Detect more ways to start bullet list items * Besides the previous " * ", detect " - ", "* " and "- ". b7cb458: 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. [ Stephan Aßmus <superstippi@xxxxxx> ] ---------------------------------------------------------------------------- 1 file changed, 40 insertions(+), 2 deletions(-) src/apps/haiku-depot/textview/MarkupParser.cpp | 42 ++++++++++++++++++++-- ############################################################################ Commit: 9fb4da1c9d18516099193b3c2cf85aa946218dd5 URL: http://cgit.haiku-os.org/haiku/commit/?id=9fb4da1 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Sun Nov 24 19:54:27 2013 UTC HaikuDepot: Detect more ways to start bullet list items * Besides the previous " * ", detect " - ", "* " and "- ". ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/textview/MarkupParser.cpp b/src/apps/haiku-depot/textview/MarkupParser.cpp index 8025be1..5d3b8ad 100644 --- a/src/apps/haiku-depot/textview/MarkupParser.cpp +++ b/src/apps/haiku-depot/textview/MarkupParser.cpp @@ -195,11 +195,11 @@ MarkupParser::_ParseText(const BString& text) break; case ' ': - // Detect bullets at line starts + // Detect bullets at line starts (preceeding space) if (offset == start && fCurrentParagraph.IsEmpty() && offset + 2 < charCount - && c[0] == '*' && c[1] == ' ') { + && (c[0] == '*' || c[0] == '-') && c[1] == ' ') { fCurrentParagraph.SetStyle(fBulletStyle); @@ -210,6 +210,23 @@ MarkupParser::_ParseText(const BString& text) } break; + case '*': + case '-': + // Detect bullets at line starts (no preceeding space) + if (offset == start + && fCurrentParagraph.IsEmpty() + && offset + 1 < charCount + && c[0] == ' ') { + + fCurrentParagraph.SetStyle(fBulletStyle); + + offset += 1; + c += 1; + + start = offset + 1; + } + break; + default: break; ############################################################################ Revision: hrev46432 Commit: b7cb4587b0a2664d9ad9bd8cb262bf78ad2f1bef URL: http://cgit.haiku-os.org/haiku/commit/?id=b7cb458 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Sun Nov 24 20:09:31 2013 UTC 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. ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/textview/MarkupParser.cpp b/src/apps/haiku-depot/textview/MarkupParser.cpp index 5d3b8ad..285ac6f 100644 --- a/src/apps/haiku-depot/textview/MarkupParser.cpp +++ b/src/apps/haiku-depot/textview/MarkupParser.cpp @@ -137,7 +137,28 @@ MarkupParser::_ParseText(const BString& text) uint32 nextChar = UTF8ToCharCode(&c); 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': + _CopySpan(text, start, offset); + if (offset > 0 && c[-1] != ' ') + _FinishParagraph(); + start = offset + 1; + break; + case '\0': _CopySpan(text, start, offset); _FinishParagraph();