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>.
This commit is contained in:
tastytea 2022-03-09 18:37:50 +01:00
parent b82b724795
commit ddf749d3a2
No known key found for this signature in database
1 changed files with 9 additions and 1 deletions

View File

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