mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 17:57:16 +00:00
Auto expand to paragraph on clear
This commit is contained in:
parent
c5ca100680
commit
bd9b1d5f93
1 changed files with 14 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue