1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 10:17:18 +00:00

Auto expand to paragraph on clear

This commit is contained in:
M66B 2020-11-17 21:55:02 +01:00
parent c5ca100680
commit bd9b1d5f93

View file

@ -353,15 +353,22 @@ public class StyleHelper {
}
private boolean clear(MenuItem item) {
for (Object span : t.getSpans(s, e, Object.class))
int start = s;
int end = e;
// Expand to paragraph (block quotes)
if (end + 1 < t.length() && t.charAt(end) == '\n')
end++;
for (Object span : t.getSpans(start, end, Object.class))
if (!(span instanceof ImageSpan)) {
int start = t.getSpanStart(span);
int end = t.getSpanEnd(span);
int sstart = t.getSpanStart(span);
int send = t.getSpanEnd(span);
int flags = t.getSpanFlags(span);
if (start < s && end > s)
setSpan(t, span, start, s, flags, etBody.getContext());
if (start < e && end > e)
setSpan(t, span, e, end, flags, etBody.getContext());
if (sstart < start && send > start)
setSpan(t, span, sstart, start, flags, etBody.getContext());
if (sstart < end && send > end)
setSpan(t, span, end, send, flags, etBody.getContext());
t.removeSpan(span);
}