diff options
| author | Jarek Kobus <[email protected]> | 2023-06-28 18:25:42 +0200 |
|---|---|---|
| committer | Jarek Kobus <[email protected]> | 2023-07-04 12:23:12 +0000 |
| commit | 858ecf3e784f60404af458dc1fb85461334ffea8 (patch) | |
| tree | d1bc206d322f384aba27d56cca95761ca298f919 /src/plugins/git/gitgrep.cpp | |
| parent | de5efffeff8a2adebc77fd2b6888047abf8530a5 (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.cpp | 28 |
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 ¶ return Utils::asyncRun(runGitGrep, parameters); } -IEditor *GitGrep::openEditor(const SearchResultItem &item, - const FileFindParameters ¶meters) +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 ¶meters) -> 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 |
