Strip variant selector in some cases
fixes #439
Workaround for https://bugreports.qt.io/browse/QTBUG-97401
fixes #810
4 files changed, 17 insertions, 9 deletions
diff --git a/resources/qml/Reactions.qml b/resources/qml/Reactions.qml
index 076e6b64..63115ec0 100644
--- a/resources/qml/Reactions.qml
+++ b/resources/qml/Reactions.qml
@@ -34,6 +34,7 @@ Flow {
implicitHeight: contentItem.childrenRect.height
ToolTip.visible: hovered
ToolTip.text: modelData.users
+ ToolTip.delay: Nheko.tooltipDelay
onClicked: {
console.debug("Picked " + modelData.key + "in response to " + reactionFlow.eventId + ". selfReactedEvent: " + modelData.selfReactedEvent);
room.input.reaction(reactionFlow.eventId, modelData.key);
@@ -51,14 +52,14 @@ Flow {
font.family: Settings.emojiFont
elide: Text.ElideRight
elideWidth: 150
- text: modelData.key
+ text: modelData.displayKey
}
Text {
id: reactionText
anchors.baseline: reactionCounter.baseline
- text: textMetrics.elidedText + (textMetrics.elidedText == modelData.key ? "" : "…")
+ text: textMetrics.elidedText + (textMetrics.elidedText == modelData.displayKey ? "" : "…")
font.family: Settings.emojiFont
color: reaction.hovered ? Nheko.colors.highlight : Nheko.colors.text
maximumLineCount: 1
diff --git a/resources/qml/emoji/EmojiPicker.qml b/resources/qml/emoji/EmojiPicker.qml
index fd8c0720..96ed1b0e 100644
--- a/resources/qml/emoji/EmojiPicker.qml
+++ b/resources/qml/emoji/EmojiPicker.qml
@@ -166,7 +166,7 @@ Menu {
verticalAlignment: Text.AlignVCenter
font.family: Settings.emojiFont
font.pixelSize: 36
- text: model.unicode
+ text: model.unicode.replace('\ufe0f', '')
color: Nheko.colors.text
}
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 175b2770..75b3c8f2 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -135,8 +135,13 @@ utils::replaceEmoji(const QString &body)
fmtBody += QStringLiteral("<font face=\"") % UserSettings::instance()->emojiFont() %
QStringLiteral("\">");
insideFontBlock = true;
+ } else if (code == 0xfe0f) {
+ // BUG(Nico):
+ // Workaround https://bugreports.qt.io/browse/QTBUG-97401
+ // See also https://github.com/matrix-org/matrix-react-sdk/pull/1458/files
+ // Nheko bug: https://github.com/Nheko-Reborn/nheko/issues/439
+ continue;
}
-
} else {
if (insideFontBlock) {
fmtBody += QStringLiteral("</font>");
diff --git a/src/timeline/Reaction.h b/src/timeline/Reaction.h
index ef8d36ea..9ed3f801 100644
--- a/src/timeline/Reaction.h
+++ b/src/timeline/Reaction.h
@@ -11,13 +11,15 @@
struct Reaction
{
Q_GADGET
- Q_PROPERTY(QString key READ key)
- Q_PROPERTY(QString users READ users)
- Q_PROPERTY(QString selfReactedEvent READ selfReactedEvent)
- Q_PROPERTY(int count READ count)
+ Q_PROPERTY(QString key READ key CONSTANT)
+ Q_PROPERTY(QString displayKey READ displayKey CONSTANT)
+ Q_PROPERTY(QString users READ users CONSTANT)
+ Q_PROPERTY(QString selfReactedEvent READ selfReactedEvent CONSTANT)
+ Q_PROPERTY(int count READ count CONSTANT)
public:
- QString key() const { return key_.toHtmlEscaped(); }
+ QString key() const { return key_; }
+ QString displayKey() const { return key_.toHtmlEscaped().remove(QStringLiteral(u"\ufe0f")); }
QString users() const { return users_.toHtmlEscaped(); }
QString selfReactedEvent() const { return selfReactedEvent_; }
int count() const { return count_; }
|