From 9fb4da1c9d18516099193b3c2cf85aa946218dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 24 Nov 2013 20:54:27 +0100 Subject: [PATCH] HaikuDepot: Detect more ways to start bullet list items * Besides the previous " * ", detect " - ", "* " and "- ". --- .../haiku-depot/textview/MarkupParser.cpp | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/apps/haiku-depot/textview/MarkupParser.cpp b/src/apps/haiku-depot/textview/MarkupParser.cpp index 8025be1b0d..5d3b8ad2d5 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;