Improve sorting a bit and fix some bugs in edge cases

makes nheko appear at the top, if you search for it as well as TWIM match the twim room
This commit is contained in:
Nicolas Werner 2021-04-09 17:20:07 +02:00
parent 28074794e7
commit 7d6bd67615
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 57 additions and 40 deletions

View file

@ -28,12 +28,15 @@ CompletionProxyModel::CompletionProxyModel(QAbstractItemModel *model,
->data(sourceModel()->index(i, 0), CompletionModel::SearchRole)
.toString()
.toLower();
trie_.insert(string1.toUcs4(), i);
if (!string1.isEmpty())
trie_.insert(string1.toUcs4(), i);
auto string2 = sourceModel()
->data(sourceModel()->index(i, 0), CompletionModel::SearchRole2)
.toString()
.toLower();
if (!string2.isEmpty())
trie_.insert(string2.toUcs4(), i);
}
// insert the partial matches