From a0f86be19aa6144cba9e125c8a257c6d5877da43 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 12 Aug 2020 10:35:01 +0200 Subject: [PATCH] Auto expand list selection --- app/src/main/java/eu/faircode/email/StyleHelper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/StyleHelper.java b/app/src/main/java/eu/faircode/email/StyleHelper.java index 4f87b389e4..6bfb42ff35 100644 --- a/app/src/main/java/eu/faircode/email/StyleHelper.java +++ b/app/src/main/java/eu/faircode/email/StyleHelper.java @@ -207,11 +207,14 @@ public class StyleHelper { int dp6 = Helper.dp2pixels(context, 6); float textSize = Helper.getTextSize(context, 0); + int end = e; + if (e > 1 && e + 1 < t.length() && t.charAt(e - 1) != '\n' && t.charAt(e) == '\n') + end++; int i = s; int j = s + 1; int index = 1; - while (j < e) { + while (j < end) { if (i > 0 && t.charAt(i - 1) == '\n' && t.charAt(j) == '\n') { if (item.getItemId() == R.id.menu_style_list_bullets) if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) @@ -227,6 +230,7 @@ public class StyleHelper { } etBody.setText(t); + etBody.setSelection(s, end); return true; }