summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authortastytea <tastytea@tastytea.de>2022-03-09 18:37:50 +0100
committertastytea <tastytea@tastytea.de>2022-03-09 18:51:29 +0100
commitddf749d3a2fda3bcc203c481faf329bbb635622d (patch)
tree3da6465c989fbb0b57bf5c3fbed826c67d78e643 /resources/qml
parentShow long reaction text in tooltip (diff)
downloadnheko-ddf749d3a2fda3bcc203c481faf329bbb635622d.tar.xz
Remove extra … from reaction text if it is already there
elidedText should have … in it if the text doesn't fit, but it seems
that it is omitted if the emoji font doesn't have it. 🙄
See <https://github.com/Nheko-Reborn/nheko/pull/982>.
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/Reactions.qml10
1 files changed, 9 insertions, 1 deletions
diff --git a/resources/qml/Reactions.qml b/resources/qml/Reactions.qml
index f79cfe73..cb2bcb24 100644
--- a/resources/qml/Reactions.qml
+++ b/resources/qml/Reactions.qml
@@ -66,7 +66,15 @@ Flow {
                     id: reactionText
 
                     anchors.baseline: reactionCounter.baseline
-                    text: textMetrics.elidedText + (textMetrics.elidedText == modelData.displayKey ? "" : "…")
+                    text: {
+                        // When an emoji font is selected that doesn't have …, it is dropped from elidedText. So we add it back.
+                        if (textMetrics.elidedText !== modelData.displayKey) {
+                            if (!textMetrics.elidedText.endsWith("…")) {
+                                return textMetrics.elidedText + "…";
+                            }
+                        }
+                        return textMetrics.elidedText;
+                    }
                     font.family: Settings.emojiFont
                     color: reaction.hovered ? Nheko.colors.highlight : Nheko.colors.text
                     maximumLineCount: 1