Commit 3b50ed40 authored by Kåre Särs's avatar Kåre Särs
Browse files

Re-Add sorting of the files in the result

parent 426ea782
......@@ -66,6 +66,14 @@ void MatchModel::setSearchState(MatchModel::SearchState searchState)
{
m_searchState = searchState;
if (!m_infoUpdateTimer.isActive()) m_infoUpdateTimer.start();
if (m_searchState == SearchDone) {
beginResetModel();
std::sort(m_matchFiles.begin(), m_matchFiles.end(), [](const MatchFile &l, const MatchFile &r) { return l.fileUrl < r.fileUrl; });
for (int i=0; i<m_matchFiles.size(); ++i) {
m_matchFileIndexHash[m_matchFiles[i].fileUrl] = i;
}
endResetModel();
}
}
void MatchModel::setBaseSearchPath(const QString &baseSearchPath)
......
......@@ -1242,13 +1242,14 @@ void KatePluginSearchView::searchDone()
m_curResults->treeView->setColumnWidth(0, m_curResults->treeView->width() - 30);
}
// Set search to done. This sorts the model and collapses all items in the view
m_curResults->matchModel.setSearchState(MatchModel::SearchDone);
// expand the "header item " to display all files and all results if configured
expandResults();
indicateMatch(m_curResults->matches > 0);
m_curResults->matchModel.setSearchState(MatchModel::SearchDone);
m_curResults = nullptr;
m_toolView->unsetCursor();
......@@ -1278,10 +1279,14 @@ void KatePluginSearchView::searchWhileTypingDone()
m_curResults->treeView->setColumnWidth(0, m_curResults->treeView->width() - 30);
}
indicateMatch(m_curResults->matches > 0);
// Set search to done. This sorts the model and collapses all items in the view
m_curResults->matchModel.setSearchState(MatchModel::SearchDone);
// expand the "header item " to display all files and all results if configured
expandResults();
indicateMatch(m_curResults->matches > 0);
m_curResults = nullptr;
if (popupVisible) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment