diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 47ca8e10..8cab66c1 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -134,11 +134,14 @@ namespace SourceGit.ViewModels { if (commits.Count == 0) { + _repo.SearchResultSelectedCommit = null; DetailContext = null; } else if (commits.Count == 1) { var commit = commits[0] as Models.Commit; + _repo.SearchResultSelectedCommit = commit; + AutoSelectedCommit = commit; NavigationId = _navigationId + 1; @@ -155,12 +158,15 @@ namespace SourceGit.ViewModels } else if (commits.Count == 2) { + _repo.SearchResultSelectedCommit = null; + var end = commits[0] as Models.Commit; var start = commits[1] as Models.Commit; DetailContext = new RevisionCompare(_repo.FullPath, start, end); } else { + _repo.SearchResultSelectedCommit = null; DetailContext = new CountSelectedCommits() { Count = commits.Count }; } } @@ -369,18 +375,6 @@ namespace SourceGit.ViewModels return menu; } - public void NotifyAutoSelectedCommitChanged() - { - if (DetailContext is CommitDetail detail) - { - _repo.HandleSelectedCommitChanged(detail.Commit); - } - else - { - _repo.HandleSelectedCommitChanged(null); - } - } - private void FillCurrentBranchMenu(ContextMenu menu, Models.Branch current) { var submenu = new MenuItem(); diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 89807206..0e67f11b 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -1354,14 +1354,6 @@ namespace SourceGit.ViewModels return menu; } - public void HandleSelectedCommitChanged(Models.Commit commit) - { - if (SearchedCommits.Count > 0) - { - SearchResultSelectedCommit = commit; - } - } - private string _fullpath = string.Empty; private string _gitDir = string.Empty; private Models.GitFlow _gitflow = new Models.GitFlow(); diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index cbed193b..13f05aff 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -291,7 +291,6 @@ namespace SourceGit.Views if (DataContext is ViewModels.Histories histories) { histories.Select(commitDataGrid.SelectedItems); - histories.NotifyAutoSelectedCommitChanged(); } e.Handled = true; }