1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-03-01 17:26:12 +00:00

Optimization

This commit is contained in:
M66B 2023-11-25 07:39:27 +01:00
parent fa2044668c
commit 3f5a7a72d3

View file

@ -3876,17 +3876,24 @@ public class HtmlHelper {
int s = start.get(spans[i]);
int e = end.get(spans[i]);
int f = flags.get(spans[i]);
boolean changed = false;
if (spans[i] instanceof AlignmentSpan ||
spans[i] instanceof BulletSpan ||
spans[i] instanceof NumberSpan) {
if (spans[i] instanceof AlignmentSpan &&
!(e > 0 && ssb.charAt(e - 1) == '\n') &&
e < ssb.length() && ssb.charAt(e) == '\n')
e < ssb.length() && ssb.charAt(e) == '\n') {
e++;
if (s > 0 && ssb.charAt(s - 1) == '\n' &&
e > 0 && ssb.charAt(e - 1) == '\n')
f |= Spanned.SPAN_PARAGRAPH;
changed = true;
}
if ((f & Spanned.SPAN_PARAGRAPH) == 0 &&
s > 0 && ssb.charAt(s - 1) == '\n' &&
e > 0 && ssb.charAt(e - 1) == '\n') {
f |= Spanned.SPAN_PARAGRAPH;
changed = true;
}
}
if (changed)
ssb.setSpan(spans[i], s, e, f);
}