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

Added paragraph destroyer

This commit is contained in:
M66B 2020-11-18 18:42:03 +01:00
parent 71b919b40d
commit 7ebca45d28

View file

@ -500,7 +500,7 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
public void beforeTextChanged(CharSequence text, int start, int count, int after) { public void beforeTextChanged(CharSequence text, int start, int count, int after) {
if (count == 1 && after == 0 && text.charAt(start) == '\n') { if (count == 1 && after == 0 && (start == 0 || text.charAt(start) == '\n')) {
Log.i("Removed=" + start); Log.i("Removed=" + start);
removed = start; removed = start;
} }
@ -607,7 +607,17 @@ public class FragmentCompose extends FragmentBase {
} }
if (removed != null) { if (removed != null) {
ParagraphStyle[] ps = text.getSpans(removed, removed + 1, ParagraphStyle.class);
if (ps != null)
for (ParagraphStyle p : ps) {
int start = text.getSpanStart(p);
int end = text.getSpanEnd(p);
if (start == removed && end == removed + 1)
text.removeSpan(p);
}
StyleHelper.renumber(text, true, etBody.getContext()); StyleHelper.renumber(text, true, etBody.getContext());
removed = null; removed = null;
} }
} }