fix(HtmlParser): remove trailing line breaks

Some fediverse servers (e.g. lemmy) add a trailing line break to the
content. Since we add them as well, this can cause up to three line
breaks at the end of a post, resulting in a blank space.
This removes the trailing line breaks before parsing the content.
This commit is contained in:
FineFindus 2024-06-27 21:40:52 +02:00
parent e8ce2a7e35
commit 618946a8c6
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B
1 changed files with 3 additions and 0 deletions

View File

@ -123,6 +123,9 @@ public class HtmlParser{
int colorInsert=UiUtils.getThemeColor(context, R.attr.colorM3Success);
int colorDelete=UiUtils.getThemeColor(context, R.attr.colorM3Error);
if(source.endsWith("\n"))
source=source.stripTrailing();
Jsoup.parseBodyFragment(source).body().traverse(new NodeVisitor(){
private final ArrayList<SpanInfo> openSpans=new ArrayList<>();