diff --git a/qml/component/MessageDelegate.qml b/qml/component/MessageDelegate.qml
index c4198aa..8237e3f 100644
--- a/qml/component/MessageDelegate.qml
+++ b/qml/component/MessageDelegate.qml
@@ -72,7 +72,7 @@ RowLayout {
TextEdit {
Layout.fillWidth: true
- text: (highlighted ? "" : "") + display
+ text: (highlighted ? "" : "") + display
visible: isText
color: highlighted ? "white": Material.foreground
diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp
index 40c009f..1c1f30f 100644
--- a/src/messageeventmodel.cpp
+++ b/src/messageeventmodel.cpp
@@ -9,6 +9,7 @@
#include
#include
+#include
#include
#include // for qmlRegisterType()
@@ -327,8 +328,14 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
[this](const RoomMessageEvent& e) {
using namespace MessageEventContent;
- if (e.hasTextContent() && e.mimeType().name() != "text/plain")
- return static_cast(e.content())->body;
+ if (e.hasTextContent() && e.mimeType().name() != "text/plain") {
+ static const QRegExp userPillRegExp(
+ "(.*)");
+ static const QRegExp replyToRegExp(
+ "In reply to");
+ return QString(static_cast(e.content())->body)
+ .replace(userPillRegExp, "\\2").replace(replyToRegExp, "");
+ }
if (e.hasFileContent()) {
auto fileCaption = e.content()->fileInfo()->originalName;
if (fileCaption.isEmpty())
@@ -416,7 +423,11 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
tr("Unknown Event"));
}
- if (role == MessageRole) return evt.contentJson().value("body");
+ if (role == MessageRole) {
+ static const QRegExp rmReplyRegExp("^> <@.*:.*> .*\n\n(.*)");
+ return evt.contentJson().value("body").toString().replace(rmReplyRegExp,
+ "\\1");
+ }
if (role == Qt::ToolTipRole) {
return evt.originalJson();