diff --git a/CHANGELOG.md b/CHANGELOG.md index d69f5695..40e01bf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ - Bugfix: Adopt popup windows in order to force floating behavior on some window managers. (#3836) - Bugfix: Fix split focusing being broken in certain circumstances when the "Show input when it's empty" setting was disabled. (#3838, #3860) - Bugfix: Always refresh tab when a contained split's channel is set. (#3849) +- Bugfix: Drop trailing whitespace from Twitch system messages. (#3888) - Dev: Remove official support for QMake. (#3839, #3883) - Dev: Rewrite LimitedQueue (#3798) - Dev: Overhaul highlight system by moving all checks into a Controller allowing for easier tests. (#3399, #3801, #3835) diff --git a/src/messages/MessageBuilder.cpp b/src/messages/MessageBuilder.cpp index c34fd3b8..c74615b4 100644 --- a/src/messages/MessageBuilder.cpp +++ b/src/messages/MessageBuilder.cpp @@ -12,6 +12,7 @@ #include "singletons/Resources.hpp" #include "singletons/Theme.hpp" #include "util/FormatTime.hpp" +#include "util/Qt.hpp" #include @@ -185,19 +186,19 @@ MessageBuilder::MessageBuilder(SystemMessageTag, const QString &text, // check system message for links // (e.g. needed for sub ticket message in sub only mode) - const QStringList textFragments = text.split(QRegularExpression("\\s")); + const QStringList textFragments = + text.split(QRegularExpression("\\s"), Qt::SkipEmptyParts); for (const auto &word : textFragments) { const auto linkString = this->matchLink(word); - if (linkString.isEmpty()) - { - this->emplace(word, MessageElementFlag::Text, - MessageColor::System); - } - else + if (!linkString.isEmpty()) { this->addLink(word, linkString); + continue; } + + this->emplace(word, MessageElementFlag::Text, + MessageColor::System); } this->message().flags.set(MessageFlag::System); this->message().flags.set(MessageFlag::DoNotTriggerNotification);