diff options
author | Benjamin Saunders <ben.e.saunders@gmail.com> | 2017-11-05 14:29:02 -0800 |
---|---|---|
committer | mujx <mujx@users.noreply.github.com> | 2017-11-06 00:29:02 +0200 |
commit | e19775443acd91943175b4d1c8b6d1b99b2ee540 (patch) | |
tree | 27bdd96bd7f8a49fc4b1a83f82756027ad757018 | |
parent | d0d15f8f58b6bd62aa306d8983f94d469108a7cf (diff) |
Fix newlines not being displayed (#122)
Fixes #64
-rw-r--r-- | src/TimelineItem.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/TimelineItem.cc b/src/TimelineItem.cc index 77bb8b9e..bd778175 100644 --- a/src/TimelineItem.cc +++ b/src/TimelineItem.cc @@ -92,6 +92,7 @@ TimelineItem::TimelineItem(events::MessageEventType ty, } body = body.toHtmlEscaped(); + body.replace("\n", "<br/>"); body.replace(URL_REGEX, URL_HTML); generateTimestamp(timestamp); @@ -197,7 +198,8 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Notice> &event, " sent a notification", descriptiveTime(QDateTime::fromMSecsSinceEpoch(event.timestamp()))}; - auto body = event.content().body().trimmed().toHtmlEscaped(); + auto body = event.content().body().trimmed().toHtmlEscaped(); + body.replace("\n", "<br/>"); auto timestamp = QDateTime::fromMSecsSinceEpoch(event.timestamp()); generateTimestamp(timestamp); @@ -244,6 +246,7 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Emote> &event, generateTimestamp(timestamp); emoteMsg = emoteMsg.toHtmlEscaped(); + emoteMsg.replace("\n", "<br/>"); emoteMsg.replace(URL_REGEX, URL_HTML); if (with_sender) { @@ -283,6 +286,7 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Text> &event, generateTimestamp(timestamp); body = body.toHtmlEscaped(); + body.replace("\n", "<br/>"); body.replace(URL_REGEX, URL_HTML); if (with_sender) { |