Fixed comma appended to username completion when not at the beginning of the message (#3060)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Paweł
2021-07-24 12:01:50 +02:00
committed by GitHub
parent ae9f92ded9
commit 588ed557f0
13 changed files with 97 additions and 22 deletions
+8 -6
View File
@@ -10,6 +10,7 @@
#include "providers/twitch/TwitchIrcServer.hpp"
#include "singletons/Emotes.hpp"
#include "singletons/Settings.hpp"
#include "util/Helpers.hpp"
#include "util/QStringHash.hpp"
#include <QtAlgorithms>
@@ -150,9 +151,6 @@ void CompletionModel::refresh(const QString &prefix, bool isFirstWord)
}
// Usernames
QString usernamePostfix =
isFirstWord && getSettings()->mentionUsersWithComma ? "," : QString();
if (prefix.startsWith("@"))
{
QString usernamePrefix = prefix;
@@ -162,8 +160,10 @@ void CompletionModel::refresh(const QString &prefix, bool isFirstWord)
for (const auto &name : chatters)
{
addString("@" + name + usernamePostfix,
TaggedString::Type::Username);
addString(
"@" + formatUserMention(name, isFirstWord,
getSettings()->mentionUsersWithComma),
TaggedString::Type::Username);
}
}
else if (!getSettings()->userCompletionOnlyWithAt)
@@ -172,7 +172,9 @@ void CompletionModel::refresh(const QString &prefix, bool isFirstWord)
for (const auto &name : chatters)
{
addString(name + usernamePostfix, TaggedString::Type::Username);
addString(formatUserMention(name, isFirstWord,
getSettings()->mentionUsersWithComma),
TaggedString::Type::Username);
}
}