logic: Fixed sorting of search results and crash in undo redo controller
This commit is contained in:
@@ -220,8 +220,8 @@ std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& qu
|
||||
const size_t maxResultCount = 100;
|
||||
std::vector<SearchResult> elementResults = m_elementIndex.search(query, maxResultCount);
|
||||
std::sort(elementResults.begin(), elementResults.end(), [](
|
||||
SearchResult a,
|
||||
SearchResult b)
|
||||
const SearchResult& a,
|
||||
const SearchResult& b)
|
||||
{
|
||||
// should a be ranked higher than b?
|
||||
if (a.score > b.score)
|
||||
@@ -240,7 +240,7 @@ std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& qu
|
||||
// move uppercase letters to higher ascii range
|
||||
std::string sA = utility::switchCases(a.text);
|
||||
std::string sB = utility::switchCases(b.text);
|
||||
return (sA.compare(sB) <= 0);
|
||||
return (sA.compare(sB) < 0);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user