fix tabbing usernames with @

This commit is contained in:
Rasmus Karlsson 2018-09-21 13:57:39 +02:00
parent eb230494a6
commit 92bf1adf88

View file

@ -100,9 +100,19 @@ void CompletionModel::refresh(const QString &prefix)
if (prefix.length() >= UsernameSet::PrefixLength) {
auto usernames = channel->accessChatters();
for (const auto &name : usernames->subrange(Prefix(prefix))) {
addString(name, TaggedString::Type::Username);
addString("@" + name, TaggedString::Type::Username);
QString usernamePrefix = prefix;
if (usernamePrefix.startsWith("@")) {
usernamePrefix.remove(0, 1);
for (const auto &name :
usernames->subrange(Prefix(usernamePrefix))) {
addString("@" + name, TaggedString::Type::Username);
}
} else {
for (const auto &name :
usernames->subrange(Prefix(usernamePrefix))) {
addString(name, TaggedString::Type::Username);
}
}
}