aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git/gitgrep.cpp
diff options
context:
space:
mode:
authorJarek Kobus <[email protected]>2023-06-28 18:25:42 +0200
committerJarek Kobus <[email protected]>2023-07-04 12:23:12 +0000
commit858ecf3e784f60404af458dc1fb85461334ffea8 (patch)
treed1bc206d322f384aba27d56cca95761ca298f919 /src/plugins/git/gitgrep.cpp
parentde5efffeff8a2adebc77fd2b6888047abf8530a5 (diff)
SearchEngine: Replace openEditor() with editorOpener()
Change-Id: I45da343f4df3cf634c24bbb518703c856fbb4d90 Reviewed-by: <[email protected]> Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Orgad Shaneh <[email protected]>
Diffstat (limited to 'src/plugins/git/gitgrep.cpp')
-rw-r--r--src/plugins/git/gitgrep.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/plugins/git/gitgrep.cpp b/src/plugins/git/gitgrep.cpp
index 8f404c8f380..b0bc3549776 100644
--- a/src/plugins/git/gitgrep.cpp
+++ b/src/plugins/git/gitgrep.cpp
@@ -269,20 +269,22 @@ QFuture<SearchResultItems> GitGrep::executeSearch(const FileFindParameters &para
return Utils::asyncRun(runGitGrep, parameters);
}
-IEditor *GitGrep::openEditor(const SearchResultItem &item,
- const FileFindParameters &parameters)
+EditorOpener GitGrep::editorOpener() const
{
- const GitGrepParameters params = parameters.searchEngineParameters.value<GitGrepParameters>();
- const QStringList &itemPath = item.path();
- if (params.ref.isEmpty() || itemPath.isEmpty())
- return nullptr;
- const FilePath path = FilePath::fromUserInput(itemPath.first());
- const FilePath topLevel = FilePath::fromString(parameters.additionalParameters.toString());
- IEditor *editor = m_client->openShowEditor(topLevel, params.ref, path,
- GitClient::ShowEditor::OnlyIfDifferent);
- if (editor)
- editor->gotoLine(item.mainRange().begin.line, item.mainRange().begin.column);
- return editor;
+ return [](const Utils::SearchResultItem &item,
+ const FileFindParameters &parameters) -> IEditor * {
+ const GitGrepParameters params = parameters.searchEngineParameters.value<GitGrepParameters>();
+ const QStringList &itemPath = item.path();
+ if (params.ref.isEmpty() || itemPath.isEmpty())
+ return nullptr;
+ const FilePath path = FilePath::fromUserInput(itemPath.first());
+ const FilePath topLevel = FilePath::fromString(parameters.additionalParameters.toString());
+ IEditor *editor = GitClient::instance()->openShowEditor(
+ topLevel, params.ref, path, GitClient::ShowEditor::OnlyIfDifferent);
+ if (editor)
+ editor->gotoLine(item.mainRange().begin.line, item.mainRange().begin.column);
+ return editor;
+ };
}
} // Git::Internal