mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fix tab completion
Fixes #813 This has the "quirk" of not updating names that are already there, which means that display names might not always be used, instead the users lowercase name might just be there and stick
This commit is contained in:
parent
2492a0ba21
commit
ee9b0f4c12
|
@ -59,7 +59,7 @@ void UsernameSet::insertPrefix(const QString &value)
|
||||||
{
|
{
|
||||||
auto &string = this->firstKeyForPrefix[Prefix(value)];
|
auto &string = this->firstKeyForPrefix[Prefix(value)];
|
||||||
|
|
||||||
if (string.isNull() || value < string)
|
if (string.isNull() || value.compare(string, Qt::CaseInsensitive) < 0)
|
||||||
string = value;
|
string = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,13 @@ struct hash<chatterino::Prefix> {
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
struct CaseInsensitiveLess {
|
||||||
|
bool operator()(const QString &lhs, const QString &rhs) const
|
||||||
|
{
|
||||||
|
return lhs.compare(rhs, Qt::CaseInsensitive) < 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class UsernameSet
|
class UsernameSet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -71,7 +78,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void insertPrefix(const QString &string);
|
void insertPrefix(const QString &string);
|
||||||
|
|
||||||
std::set<QString> items;
|
std::set<QString, CaseInsensitiveLess> items;
|
||||||
std::unordered_map<Prefix, QString> firstKeyForPrefix;
|
std::unordered_map<Prefix, QString> firstKeyForPrefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue