Implement workaround for combined emoji (#3469)

This commit is contained in:
Mm2PL
2022-01-11 00:18:02 +00:00
committed by GitHub
parent dfa3818a70
commit 820099821a
5 changed files with 47 additions and 7 deletions
+16
View File
@@ -23,6 +23,22 @@
namespace chatterino {
// This is to make sure that combined emoji go through properly, see
// https://github.com/Chatterino/chatterino2/issues/3384 and
// https://mm2pl.github.io/emoji_rfc.pdf for more details
const QString ZERO_WIDTH_JOINER = QString(QChar(0x200D));
// Here be MSVC: Do NOT replace with "\U" literal, it will fail silently.
namespace {
const QChar ESCAPE_TAG_CHARS[2] = {QChar::highSurrogate(0xE0002),
QChar::lowSurrogate(0xE0002)};
}
const QString ESCAPE_TAG = QString(ESCAPE_TAG_CHARS, 2);
const static QRegularExpression COMBINED_FIXER(
QString("(?<!%1)%1").arg(ESCAPE_TAG),
QRegularExpression::UseUnicodePropertiesOption);
enum class HighlightState;
struct Emote;