diff --git a/src/common/UsernameSet.cpp b/src/common/UsernameSet.cpp index 8e0a53af7..d39b8a3e4 100644 --- a/src/common/UsernameSet.cpp +++ b/src/common/UsernameSet.cpp @@ -59,7 +59,7 @@ void UsernameSet::insertPrefix(const QString &value) { auto &string = this->firstKeyForPrefix[Prefix(value)]; - if (string.isNull() || value < string) + if (string.isNull() || value.compare(string, Qt::CaseInsensitive) < 0) string = value; } diff --git a/src/common/UsernameSet.hpp b/src/common/UsernameSet.hpp index 0d37f8851..f33d7d7e6 100644 --- a/src/common/UsernameSet.hpp +++ b/src/common/UsernameSet.hpp @@ -38,6 +38,13 @@ struct hash { namespace chatterino { +struct CaseInsensitiveLess { + bool operator()(const QString &lhs, const QString &rhs) const + { + return lhs.compare(rhs, Qt::CaseInsensitive) < 0; + } +}; + class UsernameSet { public: @@ -71,7 +78,7 @@ public: private: void insertPrefix(const QString &string); - std::set items; + std::set items; std::unordered_map firstKeyForPrefix; };