From 6c8d9c30ab4d11a950a44b66c908bf503c3bceda Mon Sep 17 00:00:00 2001 From: kosyak Date: Wed, 14 Feb 2024 18:18:16 +0100 Subject: [PATCH] fix multiline reply quote --- .../siacs/conversations/entities/Message.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 9fb20e9e3..863141338 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -842,7 +842,7 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable public SpannableStringBuilder getBodyForDisplaying() { if (replyMessage != null) { try { - return new SpannableStringBuilder(MessageUtils.filterLtrRtl(">" + removeReplyFallback(replyMessage) + "\n" + removeReplyFallback(this)).trim()); + return new SpannableStringBuilder(MessageUtils.filterLtrRtl(getReplyText(replyMessage) + "\n" + removeReplyFallback(this)).trim()); } catch (IndexOutOfBoundsException e) { return new SpannableStringBuilder(MessageUtils.filterLtrRtl(this.body).trim()); } @@ -853,12 +853,26 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable public SpannableStringBuilder getBodyForReplyPreview() { try { - return new SpannableStringBuilder(MessageUtils.filterLtrRtl(">" + removeReplyFallback(this)).trim()); + return new SpannableStringBuilder(MessageUtils.filterLtrRtl(getReplyText(this).toString()).trim()); } catch (IndexOutOfBoundsException e) { return new SpannableStringBuilder(MessageUtils.filterLtrRtl(this.body).trim()); } } + private StringBuilder getReplyText(Message message) { + StringBuilder reply = removeReplyFallback(message); + reply.insert(0, '>'); + for (int i=0;i"); + i++; + } + } + + return reply; + } + private StringBuilder removeReplyFallback(Message message) { StringBuilder sb = new StringBuilder(message.body);