Commit e30d39f8 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Search: Dont enable multiline search when regex mode is disabled

BUG: 457146
parent 81a99c39
Pipeline #215595 passed with stage
in 6 minutes and 17 seconds
......@@ -24,7 +24,7 @@ SearchDiskFiles::SearchDiskFiles(SearchDiskFilesWorkList &worklist, const QRegul
void SearchDiskFiles::run()
{
// do we need to search multiple lines?
const bool multiLineSearch = m_regExp.pattern().contains(QLatin1String("\\n"));
const bool multiLineSearch = m_regExp.patternOptions().testFlag(QRegularExpression::MultilineOption) && m_regExp.pattern().contains(QLatin1String("\\n"));
// timer to emit matchesFound once in a time even for files without matches
// this triggers process in the UI
......
......@@ -86,7 +86,7 @@ int SearchOpenFiles::searchOpenFile(KTextEditor::Document *doc, const QRegularEx
Q_EMIT searching(doc->url().toString());
}
if (regExp.pattern().contains(QLatin1String("\\n"))) {
if (regExp.patternOptions().testFlag(QRegularExpression::MultilineOption) && regExp.pattern().contains(QLatin1String("\\n"))) {
return searchMultiLineRegExp(doc, regExp, startLine);
}
......
......@@ -987,7 +987,7 @@ void KatePluginSearchView::startSearch()
patternOptions |= QRegularExpression::CaseInsensitiveOption;
}
if (pattern.contains(QLatin1String("\\n"))) {
if (m_ui.useRegExp->isChecked() && pattern.contains(QLatin1String("\\n"))) {
patternOptions |= QRegularExpression::MultilineOption;
}
QRegularExpression reg(pattern, patternOptions);
......@@ -1166,7 +1166,7 @@ void KatePluginSearchView::startSearchWhileTyping()
if (!m_ui.matchCase->isChecked()) {
patternOptions |= QRegularExpression::CaseInsensitiveOption;
}
if (pattern.contains(QLatin1String("\\n"))) {
if (m_curResults->useRegExp && pattern.contains(QLatin1String("\\n"))) {
patternOptions |= QRegularExpression::MultilineOption;
}
QRegularExpression reg(pattern, patternOptions);
......
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