From 92bf1adf884ab5d69cb58b8bf1968d6318c6d1f1 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Fri, 21 Sep 2018 13:57:39 +0200 Subject: [PATCH] fix tabbing usernames with @ --- src/common/CompletionModel.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/common/CompletionModel.cpp b/src/common/CompletionModel.cpp index 8ccafb8e5..3669ef268 100644 --- a/src/common/CompletionModel.cpp +++ b/src/common/CompletionModel.cpp @@ -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); + } } }