diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-05-13 20:41:04 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-05-13 21:44:24 +0900 |
commit | 346adee1810109f4b7b14298e55d29a44c076a66 (patch) | |
tree | 1f5a433bc930ec65e6c5a3ba6f926ecb82743813 /lib/util.cpp | |
parent | 2d39b1e51e500fa17788630cd0e6a57a451eb475 (diff) | |
download | libquotient-346adee1810109f4b7b14298e55d29a44c076a66.tar.gz libquotient-346adee1810109f4b7b14298e55d29a44c076a66.zip |
prettyPrint(): First linkify, than add more tags
Otherwise the linkification gets confused by HTML tags being already
there and doesn't linkify what has to be linkified if that occurs at the
beginning of the message.
Diffstat (limited to 'lib/util.cpp')
-rw-r--r-- | lib/util.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/util.cpp b/lib/util.cpp index c3e21c8e..0248e521 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -74,12 +74,11 @@ QString QMatrixClient::sanitized(const QString& plainText) QString QMatrixClient::prettyPrint(const QString& plainText) { - auto pt = QStringLiteral("<span style='white-space:pre-wrap'>") + - plainText.toHtmlEscaped() + QStringLiteral("</span>"); - pt.replace('\n', QStringLiteral("<br/>")); - + auto pt = plainText.toHtmlEscaped(); linkifyUrls(pt); - return pt; + pt.replace('\n', QStringLiteral("<br/>")); + return QStringLiteral("<span style='white-space:pre-wrap'>") + pt + + QStringLiteral("</span>"); } QString QMatrixClient::cacheLocation(const QString& dirName) |