summary refs log tree commit diff
path: root/src/CompletionProxyModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-04-09 17:20:07 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-04-09 17:20:07 +0200
commit7d6bd67615ad1e5d696fb1572308934314d7fb67 (patch)
tree3249cc8650c79dac99e44c1ddb73763195fe40d7 /src/CompletionProxyModel.cpp
parentFix undefined warning (diff)
downloadnheko-7d6bd67615ad1e5d696fb1572308934314d7fb67.tar.xz
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
Diffstat (limited to '')
-rw-r--r--src/CompletionProxyModel.cpp5
1 files changed, 4 insertions, 1 deletions
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