From bd8938b1df2abafff273b9f56cc6eec5869fa0e9 Mon Sep 17 00:00:00 2001
From: cberthet <capucine.berthet@savoirfairelinux.com>
Date: Mon, 18 Dec 2023 12:09:31 -0500
Subject: [PATCH] TextMessageDelegate: resolve binding loop issue

Change-Id: Ia17240ba8ff20dd09ad58463e44fbcdc2156ed78
---
 src/app/commoncomponents/SBSMessageBase.qml      |  1 -
 src/app/commoncomponents/TextMessageDelegate.qml | 11 ++++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/app/commoncomponents/SBSMessageBase.qml b/src/app/commoncomponents/SBSMessageBase.qml
index e3ae6e1c0..39e059c82 100644
--- a/src/app/commoncomponents/SBSMessageBase.qml
+++ b/src/app/commoncomponents/SBSMessageBase.qml
@@ -54,7 +54,6 @@ Control {
     property bool textHovered: false
     property alias replyAnimation: selectAnimation
     width: listView.width
-    height: mainColumnLayout.implicitHeight
 
     property real textContentWidth
     property real textContentHeight
diff --git a/src/app/commoncomponents/TextMessageDelegate.qml b/src/app/commoncomponents/TextMessageDelegate.qml
index 2584a31b2..27f78bf57 100644
--- a/src/app/commoncomponents/TextMessageDelegate.qml
+++ b/src/app/commoncomponents/TextMessageDelegate.qml
@@ -33,7 +33,7 @@ SBSMessageBase {
     property string colorUrl: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewLinkColorLight : JamiTheme.chatviewLinkColorDark
     property string colorText: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark
 
-    bigMsg: (textEditId.lineCount > 1) || extraContent.active
+
 
     Connections {
         target: bubble
@@ -46,6 +46,7 @@ SBSMessageBase {
         }
     }
 
+
     isOutgoing: Author === CurrentAccount.uri
     author: Author
     readers: Readers
@@ -54,9 +55,11 @@ SBSMessageBase {
     formattedDay: MessagesAdapter.getFormattedDay(Timestamp)
     extraHeight: extraContent.active && !isRemoteImage ? msgRadius : -isRemoteImage
     textHovered: textHoverhandler.hovered
-    textContentWidth: textEditId.width + (bigMsg ? 0 : root.timeWidth + root.editedWidth)
+    textContentWidth: textEditId.width
     textContentHeight: textEditId.height
 
+    bigMsg: textContentWidth >= (2 / 3) * root.maxMsgWidth || extraContent.active
+
     innerContent.children: [
         TextEdit {
             id: textEditId
@@ -87,11 +90,9 @@ SBSMessageBase {
                 else if (isEmojiOnly)
                     Math.min((2 / 3) * root.maxMsgWidth, implicitWidth, innerContent.width - senderMargin - (innerContent.width - senderMargin) % (JamiTheme.chatviewEmojiSize + 2));
                 else
-                    Math.max(Math.min((2 / 3) * root.maxMsgWidth - ( bigMsg ? 0 : root.timeWidth + root.editedWidth), implicitWidth + 5, innerContent.width - senderMargin + 5 ), bigMsg ? root.timeWidth + root.editedWidth + 14: 0) ;
+                    Math.min((2 / 3) * root.maxMsgWidth, implicitWidth + 5 + root.timeWidth + root.editedWidth, innerContent.width - senderMargin + 5 + root.timeWidth + root.editedWidth);
             }
 
-            anchors.rightMargin: bigMsg ? 0 : root.timeWidth + root.editedWidth
-
             wrapMode: Label.WrapAtWordBoundaryOrAnywhere
             selectByMouse: true
             font.pointSize: isEmojiOnly ? JamiTheme.chatviewEmojiSize : (ParsedBody === "" ? JamiTheme.smallFontSize : JamiTheme.mediumFontSize)
-- 
GitLab