From 7d6bd67615ad1e5d696fb1572308934314d7fb67 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 9 Apr 2021 17:20:07 +0200 Subject: 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 --- src/CompletionProxyModel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/CompletionProxyModel.cpp') diff --git a/src/CompletionProxyModel.cpp b/src/CompletionProxyModel.cpp index 45b44fca..2341c292 100644 --- a/src/CompletionProxyModel.cpp +++ b/src/CompletionProxyModel.cpp @@ -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 -- cgit 1.5.1