From fec1e8dfccb07562397cb18a6c77319b7fd18496 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 20 Jan 2020 18:02:40 +0100 Subject: [PATCH] Prevent double line breaks --- app/src/main/java/eu/faircode/email/HtmlHelper.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index 774ec04cd7..c43a9cdf4c 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -267,6 +267,14 @@ public class HtmlHelper { // if (br.parent() != null && !hasVisibleContent(br.parent().childNodes())) // br.tagName("span"); + for (Element div : document.select("div")) + if (div.children().select("div").size() == 0 && + hasVisibleContent(div.childNodes())) { + Node last = div.childNode(div.childNodeSize() - 1); + if (last != null && "br".equals(last.nodeName())) + last.remove(); + } + // Paragraphs for (Element p : document.select("p")) { p.appendElement("br");