Drop trailing whitespace from Twitch system messages (#3888)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
James Upjohn 2022-07-31 21:55:25 +12:00 committed by GitHub
parent bda060f42e
commit a280089693
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -43,6 +43,7 @@
- Bugfix: Adopt popup windows in order to force floating behavior on some window managers. (#3836) - 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: 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: 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: Remove official support for QMake. (#3839, #3883)
- Dev: Rewrite LimitedQueue (#3798) - Dev: Rewrite LimitedQueue (#3798)
- Dev: Overhaul highlight system by moving all checks into a Controller allowing for easier tests. (#3399, #3801, #3835) - Dev: Overhaul highlight system by moving all checks into a Controller allowing for easier tests. (#3399, #3801, #3835)

View file

@ -12,6 +12,7 @@
#include "singletons/Resources.hpp" #include "singletons/Resources.hpp"
#include "singletons/Theme.hpp" #include "singletons/Theme.hpp"
#include "util/FormatTime.hpp" #include "util/FormatTime.hpp"
#include "util/Qt.hpp"
#include <QDateTime> #include <QDateTime>
@ -185,19 +186,19 @@ MessageBuilder::MessageBuilder(SystemMessageTag, const QString &text,
// check system message for links // check system message for links
// (e.g. needed for sub ticket message in sub only mode) // (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) for (const auto &word : textFragments)
{ {
const auto linkString = this->matchLink(word); const auto linkString = this->matchLink(word);
if (linkString.isEmpty()) if (!linkString.isEmpty())
{
this->emplace<TextElement>(word, MessageElementFlag::Text,
MessageColor::System);
}
else
{ {
this->addLink(word, linkString); this->addLink(word, linkString);
continue;
} }
this->emplace<TextElement>(word, MessageElementFlag::Text,
MessageColor::System);
} }
this->message().flags.set(MessageFlag::System); this->message().flags.set(MessageFlag::System);
this->message().flags.set(MessageFlag::DoNotTriggerNotification); this->message().flags.set(MessageFlag::DoNotTriggerNotification);