mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added username autocompletions with @
This commit is contained in:
parent
a0e33ef9e6
commit
454b6bcb70
|
@ -92,8 +92,9 @@ void CompletionModel::addString(const QString &str, TaggedString::Type type)
|
||||||
this->emotes.insert({str + " ", type});
|
this->emotes.insert({str + " ", type});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompletionModel::addUser(const QString &str)
|
void CompletionModel::addUser(const QString &username)
|
||||||
{
|
{
|
||||||
|
auto add = [this](const QString &str) {
|
||||||
auto ts = this->createUser(str + " ");
|
auto ts = this->createUser(str + " ");
|
||||||
// Always add a space at the end of completions
|
// Always add a space at the end of completions
|
||||||
std::pair<std::set<TaggedString>::iterator, bool> p = this->emotes.insert(ts);
|
std::pair<std::set<TaggedString>::iterator, bool> p = this->emotes.insert(ts);
|
||||||
|
@ -109,6 +110,10 @@ void CompletionModel::addUser(const QString &str)
|
||||||
p.first->timeAdded = std::chrono::steady_clock::now();
|
p.first->timeAdded = std::chrono::steady_clock::now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
add(username);
|
||||||
|
add("@" + username);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompletionModel::ClearExpiredStrings()
|
void CompletionModel::ClearExpiredStrings()
|
||||||
|
|
Loading…
Reference in a new issue