diff --git a/app/src/main/java/eu/faircode/email/HtmlEx.java b/app/src/main/java/eu/faircode/email/HtmlEx.java
index 5cfceaccd..f6db9f051 100644
--- a/app/src/main/java/eu/faircode/email/HtmlEx.java
+++ b/app/src/main/java/eu/faircode/email/HtmlEx.java
@@ -211,7 +211,7 @@ public class HtmlEx {
private /* static */ void withinBlockquoteIndividual(StringBuilder out, Spanned text, int start,
int end) {
- boolean isInList = false;
+ Boolean isInBulletList = null;
int next;
for (int i = start; i <= end; i = next) {
next = TextUtils.indexOf(text, '\n', i, end);
@@ -220,42 +220,47 @@ public class HtmlEx {
}
if (next == i) {
- if (isInList) {
+ if (isInBulletList != null) {
// Current paragraph is no longer a list item; close the previously opened list
- isInList = false;
- out.append("\n");
+ out.append(isInBulletList ? "\n" : "\n");
+ isInBulletList = null;
}
out.append("
\n");
} else {
- boolean isListItem = false;
+ Boolean isBulletListItem = null;
ParagraphStyle[] paragraphStyles = text.getSpans(i, next, ParagraphStyle.class);
for (ParagraphStyle paragraphStyle : paragraphStyles) {
final int spanFlags = text.getSpanFlags(paragraphStyle);
if ((spanFlags & Spanned.SPAN_PARAGRAPH) == Spanned.SPAN_PARAGRAPH
&& paragraphStyle instanceof BulletSpan) {
- isListItem = true;
+ isBulletListItem = !(paragraphStyle instanceof eu.faircode.email.NumberSpan);
break;
}
}
- if (isListItem && !isInList) {
+ if (isBulletListItem != null && isInBulletList != null && isBulletListItem != isInBulletList) {
+ out.append(isInBulletList ? "\n" : "\n");
+ isInBulletList = null;
+ }
+
+ if (isBulletListItem != null && isInBulletList == null) {
// Current paragraph is the first item in a list
- isInList = true;
- out.append("