Commit 0a48c27e authored by Eric Armbruster's avatar Eric Armbruster 🍁 Committed by Christoph Cullmann
Browse files

search: do not run if there are no documents open

Since recently there are cases where no document is open (e.g. only a
welcomeview), we need to make sure the search plugin does not start
a search in these cases, as it is not handled correctly.
parent 5aca93b8
Pipeline #242368 passed with stage
in 14 minutes
......@@ -951,6 +951,13 @@ void KatePluginSearchView::startSearch()
return;
}
KTextEditor::View *activeView = m_mainWindow->activeView();
QList<KTextEditor::Document *> documents;
if ((m_ui.searchPlaceCombo->currentIndex() == MatchModel::CurrentFile && !activeView)
|| (m_ui.searchPlaceCombo->currentIndex() == MatchModel::OpenFiles && m_kateApp->documents().isEmpty())) {
return;
}
m_isSearchAsYouType = false;
QString currentSearchText = m_ui.searchCombo->currentText();
......@@ -1042,10 +1049,10 @@ void KatePluginSearchView::startSearch()
if (m_ui.searchPlaceCombo->currentIndex() == MatchModel::CurrentFile) {
m_resultBaseDir.clear();
QList<KTextEditor::Document *> documents;
KTextEditor::View *activeView = m_mainWindow->activeView();
if (activeView) {
documents << activeView->document();
}
m_searchOpenFiles.startSearch(documents, reg);
} else if (m_ui.searchPlaceCombo->currentIndex() == MatchModel::OpenFiles) {
m_resultBaseDir.clear();
......
Supports Markdown
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