Strip variant selector in some cases

fixes #439
Workaround for https://bugreports.qt.io/browse/QTBUG-97401
fixes #810
This commit is contained in:
Nicolas Werner 2022-01-01 06:37:15 +01:00
parent a206500510
commit 7685d1808b
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
4 changed files with 17 additions and 9 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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>");

View File

@ -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_; }